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.
1 file changed