Open WaiLynnZaw opened 8 years ago
As far as I know, it is not related with issue #14 . I could recreate this error by doing image = null. Problem is in line 353 in AlbumSelectActivity (v0.0.4), String image is null. Does this always occur or is it only in specific use cases?
What do you mean "image = null". It is only occur in one device when I test with about 3 devices. Thanks
In the following snippet:
String album = cursor.getString(cursor.getColumnIndex(projection[0]));
String image = cursor.getString(cursor.getColumnIndex(projection[1]));
/*
It may happen that some image file paths are still present in cache,
though image file does not exist. These last as long as media
scanner is not run again. To avoid get such image file paths, check
if image file exists.
*/
file = new File(image);
by adding
image = null;
just before the statement
file = new File(image);
I could recreate the error in the device I tested on. This occurs probably because
String image = cursor.getString(cursor.getColumnIndex(projection[1]));
cursor.getString returns null. Quoting from the documentation:
"The result and whether this method throws an exception when the column value is null or the column type is not a string type is implementation-defined."
Will look into this. Quick fix solution would be:
if (image == null) {
return;
}
file = new File(image);
I'd appreciate any pull requests to fix this.
I am not sure if it is related with issue #14 and I got this error. (My android version is - 6.0.1 and I am using v.0.0.4 of multiple image select library)