1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Fix randomic NPE when pressing menus during operations

This commit is contained in:
Martino Facchin 2016-03-08 10:20:51 +01:00
parent 52ef55380d
commit ad74288e5a
2 changed files with 6 additions and 2 deletions

View File

@ -134,7 +134,11 @@ public abstract class Uploader implements MessageConsumer {
if (!process.waitFor(2, TimeUnit.MINUTES)) {
process.destroyForcibly();
}
result = process.exitValue();
if (!process.isAlive()) {
result = process.exitValue();
} else {
result = 0;
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -181,7 +181,7 @@ public class Platform {
return list;
}
public Map<String, Object> resolveDeviceByVendorIdProductId(String serial, Map<String, TargetPackage> packages) {
public synchronized Map<String, Object> resolveDeviceByVendorIdProductId(String serial, Map<String, TargetPackage> packages) {
String vid_pid_iSerial = resolveDeviceAttachedToNative(serial);
for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {