Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f2b8a9a authored by Mohammed Irfan's avatar Mohammed Irfan Committed by Sam Mortimer
Browse files

Guard in short-circuit evaluations for stringSplit methods.

* splitRange function should also check if string is empty instead of
  just checking for null, as a faulty camera can return
  an empty RangeLength string.
* See (stripped) logcat: http://pastebin.com/kVV3ZJhz

Change-Id: Icbb8f12d1c2511366856889edc9b2060b764f2d0

Camera: Use TextUtils.isEmpty to check null + empty

Change-Id: I2e2233b834a391cc10dfca8c114e699828758c16
parent 99e24beb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4497,7 +4497,7 @@ public class Camera {
        // Example string: "(10000,26623),(10000,30000)". Return null if the
        // passing string is null or the size is 0.
        private ArrayList<int[]> splitRange(String str) {
            if (str == null || str.charAt(0) != '('
            if (TextUtils.isEmpty(str) || str.charAt(0) != '('
                    || str.charAt(str.length() - 1) != ')') {
                Log.e(TAG, "Invalid range list string=" + str);
                return null;
@@ -4522,7 +4522,7 @@ public class Camera {
        // Example string: "(-10,-10,0,0,300),(0,0,10,10,700)". Return null if
        // the passing string is null or the size is 0 or (0,0,0,0,0).
        private ArrayList<Area> splitArea(String str) {
            if (str == null || str.charAt(0) != '('
            if (TextUtils.isEmpty(str) || str.charAt(0) != '('
                    || str.charAt(str.length() - 1) != ')') {
                Log.e(TAG, "Invalid area string=" + str);
                return null;