1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-07 01:54:26 +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)) { if (!process.waitFor(2, TimeUnit.MINUTES)) {
process.destroyForcibly(); process.destroyForcibly();
} }
result = process.exitValue(); if (!process.isAlive()) {
result = process.exitValue();
} else {
result = 0;
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -181,7 +181,7 @@ public class Platform {
return list; 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); String vid_pid_iSerial = resolveDeviceAttachedToNative(serial);
for (TargetPackage targetPackage : packages.values()) { for (TargetPackage targetPackage : packages.values()) {
for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) { for (TargetPlatform targetPlatform : targetPackage.getPlatforms().values()) {