Skip to content

Commit f664866

Browse files
committed
#176 Catch and wrap OutOfMemoryErrors thrown when decoding bitmaps so listeners can be called
1 parent 3c96277 commit f664866

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,9 @@ protected Bitmap doInBackground(Void... params) {
15051505
} catch (Exception e) {
15061506
Log.e(TAG, "Failed to decode tile", e);
15071507
this.exception = e;
1508+
} catch (OutOfMemoryError e) {
1509+
Log.e(TAG, "Failed to decode tile - OutOfMemoryError", e);
1510+
this.exception = new RuntimeException(e);
15081511
}
15091512
return null;
15101513
}
@@ -1576,6 +1579,9 @@ protected Integer doInBackground(Void... params) {
15761579
} catch (Exception e) {
15771580
Log.e(TAG, "Failed to load bitmap", e);
15781581
this.exception = e;
1582+
} catch (OutOfMemoryError e) {
1583+
Log.e(TAG, "Failed to load bitmap - OutOfMemoryError", e);
1584+
this.exception = new RuntimeException(e);
15791585
}
15801586
return null;
15811587
}

0 commit comments

Comments
 (0)