Skip to content

Commit 80cd946

Browse files
committed
Fix for bug 950 -- NPE Compiler.java:407 -- also searched for any other instances & found two other cases of the same bug
1 parent e35c3a2 commit 80cd946

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

app/src/processing/app/debug/Compiler.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,8 @@ private void execAsynchronously(List commandList) throws RunnerException {
401401
boolean compiling = true;
402402
while (compiling) {
403403
try {
404-
Thread t = in.thread;
405-
if (t != null)
406-
t.join();
407-
t = err.thread;
408-
if (t != null)
409-
t.join();
404+
in.join();
405+
err.join();
410406
result = process.waitFor();
411407
//System.out.println("result is " + result);
412408
compiling = false;

app/src/processing/app/debug/MessageSiphon.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,15 @@ public void run() {
8585
}
8686
}
8787

88-
88+
// Wait until the MessageSiphon thread is complete.
89+
public void join() throws java.lang.InterruptedException {
90+
// Grab a temp copy in case another thread nulls the "thread"
91+
// member variable
92+
Thread t = thread;
93+
if (t != null) t.join();
94+
}
95+
8996
public Thread getThread() {
9097
return thread;
91-
}
98+
}
9299
}

app/src/processing/app/debug/Sizer.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ public long computeSize() throws RunnerException {
6363

6464
while(running) {
6565
try {
66-
if (in.thread != null)
67-
in.thread.join();
68-
if (err.thread != null)
69-
err.thread.join();
66+
in.join();
67+
err.join();
7068
r = process.waitFor();
7169
running = false;
7270
} catch (InterruptedException intExc) { }

0 commit comments

Comments
 (0)