Utilities.trim never returns null.
This fixes a crash loop I was seeing on my device and also
preemptively fixes similar NullPointerExceptions.
Bug: 213931730
Test: Manually verified crash loop stopped with this change.
Change-Id: I8d2fc8475d42ac60b7fdc9219421a8c9733c7b9f
(cherry picked from commit 56be73be80)
This commit is contained in:
@@ -460,9 +460,10 @@ public final class Utilities {
|
||||
* Trims the string, removing all whitespace at the beginning and end of the string.
|
||||
* Non-breaking whitespaces are also removed.
|
||||
*/
|
||||
@NonNull
|
||||
public static String trim(CharSequence s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
// Just strip any sequence of whitespace or java space characters from the beginning and end
|
||||
|
||||
Reference in New Issue
Block a user