npe check after reading image uri

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/persistance/FileBackend.java | 6 
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/persistance/FileBackend.java 🔗

@@ -400,7 +400,9 @@ public class FileBackend {
 			options.inSampleSize = calcSampleSize(image,Math.max(newHeight, newWidth));
 			is = mXmppConnectionService.getContentResolver().openInputStream(image);
 			Bitmap source = BitmapFactory.decodeStream(is, null, options);
-
+			if (source == null) {
+				return null;
+			}
 			int sourceWidth = source.getWidth();
 			int sourceHeight = source.getHeight();
 			float xScale = (float) newWidth / sourceWidth;
@@ -418,8 +420,6 @@ public class FileBackend {
 			return dest;
 		} catch (FileNotFoundException e) {
 			return null;
-		} catch (IOException e) {
-			return null;
 		} finally {
 			close(is);
 		}