Skip to content

Commit d6f16ea

Browse files
committed
handle null bitmap in loadImage(), fixes #339
1 parent 490fbb5 commit d6f16ea

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

core/src/processing/core/PApplet.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3799,12 +3799,14 @@ public PImage loadImage(String filename) { //, Object params) {
37993799
}
38003800
// int much = (int) (System.currentTimeMillis() - t);
38013801
// println("loadImage(" + filename + ") was " + nfc(much));
3802-
PImage image = new PImage(bitmap);
3803-
image.parent = this;
3804-
// if (params != null) {
3805-
// image.setParams(g, params);
3806-
// }
3807-
return image;
3802+
if (bitmap == null) {
3803+
System.err.println("Could not load the image because the bitmap was empty.");
3804+
return null;
3805+
} else {
3806+
PImage image = new PImage(bitmap);
3807+
image.parent = this;
3808+
return image;
3809+
}
38083810
}
38093811

38103812

@@ -8979,6 +8981,11 @@ public void printMatrix() {
89798981
}
89808982

89818983

8984+
public void cameraUp() {
8985+
g.cameraUp();
8986+
}
8987+
8988+
89828989
public void beginCamera() {
89838990
g.beginCamera();
89848991
}

0 commit comments

Comments
 (0)