mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-13 19:27:33 +01:00
Pebble: fix NPE in getPlatformName
The NPE was triggered by recent changes in the HearthRate Charts (503cd31d917337b8fe2d56715c67cd2ff2736bc3) Since getModel was also affected by the same NPE, the function is now changed as well.
This commit is contained in:
parent
2ac7aed8d0
commit
550e6a86f2
@ -35,36 +35,39 @@ public class PebbleUtils {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PebbleUtils.class);
|
||||
|
||||
public static String getPlatformName(String hwRev) {
|
||||
String platformName;
|
||||
if (hwRev.startsWith("snowy")) {
|
||||
platformName = "basalt";
|
||||
} else if (hwRev.startsWith("spalding")) {
|
||||
platformName = "chalk";
|
||||
} else if (hwRev.startsWith("silk")) {
|
||||
platformName = "diorite";
|
||||
} else if (hwRev.startsWith("robert")) {
|
||||
platformName = "emery";
|
||||
} else {
|
||||
platformName = "aplite";
|
||||
final String DEFAULT_PLATFORM = "aplite";
|
||||
if (hwRev == null || hwRev.isEmpty()) {
|
||||
return DEFAULT_PLATFORM;
|
||||
}
|
||||
return platformName;
|
||||
|
||||
if (hwRev.startsWith("snowy")) {
|
||||
return "basalt";
|
||||
} else if (hwRev.startsWith("spalding")) {
|
||||
return "chalk";
|
||||
} else if (hwRev.startsWith("silk")) {
|
||||
return "diorite";
|
||||
} else if (hwRev.startsWith("robert")) {
|
||||
return "emery";
|
||||
}
|
||||
return DEFAULT_PLATFORM;
|
||||
}
|
||||
|
||||
public static String getModel(String hwRev) {
|
||||
//TODO: get real data?
|
||||
String model;
|
||||
if (hwRev.startsWith("snowy")) {
|
||||
model = "pebble_time_black";
|
||||
} else if (hwRev.startsWith("spalding")) {
|
||||
model = "pebble_time_round_black_20mm";
|
||||
} else if (hwRev.startsWith("silk")) {
|
||||
model = "pebble2_black";
|
||||
} else if (hwRev.startsWith("robert")) {
|
||||
model = "pebble_time2_black";
|
||||
} else {
|
||||
model = "pebble_black";
|
||||
final String DEFAULT_MODEL = "pebble_black";
|
||||
if (hwRev == null || hwRev.isEmpty()) {
|
||||
return DEFAULT_MODEL;
|
||||
}
|
||||
return model;
|
||||
if (hwRev.startsWith("snowy")) {
|
||||
return "pebble_time_black";
|
||||
} else if (hwRev.startsWith("spalding")) {
|
||||
return "pebble_time_round_black_20mm";
|
||||
} else if (hwRev.startsWith("silk")) {
|
||||
return "pebble2_black";
|
||||
} else if (hwRev.startsWith("robert")) {
|
||||
return "pebble_time2_black";
|
||||
}
|
||||
return DEFAULT_MODEL;
|
||||
}
|
||||
|
||||
public static int getFwMajor(String fwString) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user