Skip to content

Commit ad74288

Browse files
committed
Fix randomic NPE when pressing menus during operations
1 parent 52ef553 commit ad74288

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

arduino-core/src/cc/arduino/packages/Uploader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ protected boolean executeUploadCommand(String command[]) throws Exception {
134134
if (!process.waitFor(2, TimeUnit.MINUTES)) {
135135
process.destroyForcibly();
136136
}
137-
result = process.exitValue();
137+
if (!process.isAlive()) {
138+
result = process.exitValue();
139+
} else {
140+
result = 0;
141+
}
138142
} catch (Exception e) {
139143
e.printStackTrace();
140144
}

arduino-core/src/processing/app/Platform.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public List<String> listSerialsNames(){
181181
return list;
182182
}
183183

184-
public Map<String, Object> resolveDeviceByVendorIdProductId(String serial, Map<String, TargetPackage> packages) {
184+
public synchronized Map<String, Object> resolveDeviceByVendorIdProductId(String serial, Map<String, TargetPackage> packages) {
185185
String vid_pid_iSerial = resolveDeviceAttachedToNative(serial);
186186
for (TargetPackage targetPackage : packages.values()) {
187187
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {

0 commit comments

Comments
 (0)