Skip to content

Commit 4328c3d

Browse files
committed
Merge branch 'master' of github.com:processing/processing
2 parents 43ba7e7 + 2a5fbd7 commit 4328c3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/processing/core/PApplet.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5246,7 +5246,7 @@ public PImage loadImage(String filename, String extension) { //, Object params)
52465246

52475247
// await... has to run on the main thread, because P2D and P3D call GL functions
52485248
// If this runs on background, requestImage() already called await... on the main thread
5249-
if (!Thread.currentThread().getName().startsWith(ASYNC_IMAGE_LOADER_THREAD_PREFIX)) {
5249+
if (g != null && !Thread.currentThread().getName().startsWith(ASYNC_IMAGE_LOADER_THREAD_PREFIX)) {
52505250
g.awaitAsyncSaveCompletion(filename);
52515251
}
52525252

@@ -5403,7 +5403,9 @@ public PImage requestImage(String filename) {
54035403
public PImage requestImage(String filename, String extension) {
54045404
// Make sure saving to this file completes before trying to load it
54055405
// Has to be called on main thread, because P2D and P3D need GL functions
5406-
g.awaitAsyncSaveCompletion(filename);
5406+
if (g != null) {
5407+
g.awaitAsyncSaveCompletion(filename);
5408+
}
54075409
PImage vessel = createImage(0, 0, ARGB);
54085410
AsyncImageLoader ail =
54095411
new AsyncImageLoader(filename, extension, vessel);

0 commit comments

Comments
 (0)