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

Commit 9043df53 authored by Uday Kiran jandhyala's avatar Uday Kiran jandhyala Committed by Linux Build Service Account
Browse files

Fixed NullPointerException when EXIF data is invalid

For some images with no / invalid EXIF data, Gallery crashes
Fixed this bug by catching NullPointerException

Change-Id: I656fe6d526c981933c3d6eeefe67cda860206e2d
parent 2f74516b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -732,7 +732,7 @@ public class ExifInterface {
     * @param inStream an InputStream containing a jpeg compressed image.
     * @throws IOException
     */
    public void readExif(InputStream inStream) throws IOException {
    public void readExif(InputStream inStream) throws IOException, NullPointerException {
        if (inStream == null) {
            throw new IllegalArgumentException(NULL_ARGUMENT_STRING);
        }
+4 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ public final class ImageLoader {
            return parseExif(exif);
        } catch (IOException e) {
            Log.w(LOGTAG, "Failed to read EXIF orientation", e);
        } catch (NullPointerException e) {
            Log.w(LOGTAG, "Invalid EXIF data", e);
        } finally {
            try {
                if (is != null) {
@@ -576,6 +578,8 @@ public final class ImageLoader {
                return taglist;
            } catch (IOException e) {
                Log.w(LOGTAG, "Failed to read EXIF tags", e);
            } catch (NullPointerException e) {
                Log.e(LOGTAG, "Failed to read EXIF tags", e);
            }
        }
        return null;
+2 −0
Original line number Diff line number Diff line
@@ -256,6 +256,8 @@ public class SaveImage {
                Log.w(LOGTAG, "Cannot find file: " + source, e);
            } catch (IOException e) {
                Log.w(LOGTAG, "Cannot read exif for: " + source, e);
            } catch (NullPointerException e) {
                Log.w(LOGTAG, "Invalid exif data for: " + source, e);
            } finally {
                Utils.closeSilently(inStream);
            }