diff options
author | Viktor Yakovel <viktor.yakovel@sonymobile.com> | 2015-02-26 11:23:21 +0100 |
---|---|---|
committer | Ed Savage-Jones <edward.savage-jones@sonymobile.com> | 2016-04-08 08:43:16 +0000 |
commit | 523231c2f20cc14305bcf5c63feb76cd9f2a6b46 (patch) | |
tree | 828620d9aedb84ab5e252f97d27521660df21c6d | |
parent | 3e11178327751ae0cc2d034992fbab6e53656713 (diff) | |
download | android_packages_screensavers_PhotoTable-523231c2f20cc14305bcf5c63feb76cd9f2a6b46.tar.gz android_packages_screensavers_PhotoTable-523231c2f20cc14305bcf5c63feb76cd9f2a6b46.tar.bz2 android_packages_screensavers_PhotoTable-523231c2f20cc14305bcf5c63feb76cd9f2a6b46.zip |
Fixed NullPointerException during Cursor reuse
Every time an image is selected, CursorPhotoSource.naturalNext()
and naturalPrevious() functions are called to find the next/previous
images. Those functions check if a cursor which is associated with
an ImageData exists and is opened. If the cursor isn't opened then an
attempt to open a cursor is made.
The problem is that when a new ImageData is constructed inside
naturalNext() or naturalPrevious() functions, it shares the Cursor with
the currently selected image.
Later on, one of the ImageData objects closes the cursor which forces
other ImageData's to reopen it. However since uri wasn't set, null
pointer exception occurs.
Fixed by setting uri on newly created ImageData.
Bug: 28054525
Change-Id: I9ebad683089f872299343572f1df4dc7cc4ae628
-rw-r--r-- | src/com/android/dreams/phototable/CursorPhotoSource.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/com/android/dreams/phototable/CursorPhotoSource.java b/src/com/android/dreams/phototable/CursorPhotoSource.java index f010a92..6af0807 100644 --- a/src/com/android/dreams/phototable/CursorPhotoSource.java +++ b/src/com/android/dreams/phototable/CursorPhotoSource.java @@ -49,6 +49,7 @@ public abstract class CursorPhotoSource extends PhotoSource { if (!current.cursor.isAfterLast()) { data = unpackImageData(current.cursor, null); data.cursor = current.cursor; + data.uri = current.uri; data.position = current.cursor.getPosition(); } return data; @@ -66,6 +67,7 @@ public abstract class CursorPhotoSource extends PhotoSource { if (!current.cursor.isBeforeFirst()) { data = unpackImageData(current.cursor, null); data.cursor = current.cursor; + data.uri = current.uri; data.position = current.cursor.getPosition(); } return data; |