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

Commit fd1b8564 authored by Mohammed Irfan's avatar Mohammed Irfan Committed by Brandon McAnsh
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
parent 062dacbd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4461,7 +4461,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 (str == null || str.isEmpty() || str.charAt(0) != '('
                    || str.charAt(str.length() - 1) != ')') {
                Log.e(TAG, "Invalid range list string=" + str);
                return null;
@@ -4486,7 +4486,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 (str == null || str.isEmpty() || str.charAt(0) != '('
                    || str.charAt(str.length() - 1) != ')') {
                Log.e(TAG, "Invalid area string=" + str);
                return null;