Skip to content

Commit cc06b70

Browse files
committed
throw exception when trying to use pixels with no backing bitmap
1 parent b7238a4 commit cc06b70

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

core/src/processing/a2d/PGraphicsAndroid2D.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,10 @@ public void endRaw() {
20082008

20092009
@Override
20102010
public void loadPixels() {
2011-
if (bitmap == null) return;
2011+
if (bitmap == null) {
2012+
throw new RuntimeException("The pixels array is not available in this " +
2013+
"renderer withouth a backing bitmap");
2014+
}
20122015

20132016
if ((pixels == null) || (pixels.length != width * height)) {
20142017
pixels = new int[width * height];
@@ -2027,7 +2030,10 @@ public void loadPixels() {
20272030
*/
20282031
@Override
20292032
public void updatePixels() {
2030-
if (bitmap == null) return;
2033+
if (bitmap == null) {
2034+
throw new RuntimeException("The pixels array is not available in this " +
2035+
"renderer withouth a backing bitmap");
2036+
}
20312037

20322038
// WritableRaster raster = ((BufferedImage) image).getRaster();
20332039
// raster.setDataElements(0, 0, width, height, pixels);
@@ -2236,7 +2242,10 @@ public void mask(PImage alpha) {
22362242
@Override
22372243
public void copy(int sx, int sy, int sw, int sh,
22382244
int dx, int dy, int dw, int dh) {
2239-
if (bitmap == null) return;
2245+
if (bitmap == null) {
2246+
throw new RuntimeException("The pixels array is not available in this " +
2247+
"renderer withouth a backing bitmap");
2248+
}
22402249

22412250
// Bitmap bitsy = Bitmap.createBitmap(image, sx, sy, sw, sh);
22422251
// rect.set(dx, dy, dx + dw, dy + dh);

0 commit comments

Comments
 (0)