Skip to content

Commit d9ce212

Browse files
committed
Fix rail signal color differences not displayed
1 parent 08652f3 commit d9ce212

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/com/lx862/logregator/data/MTRLoggingManager.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,14 @@ public String tryGetFriendlyValue(String className, String fieldName, String raw
244244
}
245245

246246
if(fieldName.equals("color")) {
247-
int val = Integer.parseInt(value);
248-
Color color = new Color(val);
247+
try {
248+
int val = Integer.parseInt(value);
249+
Color color = new Color(val);
249250

250-
return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase();
251+
return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()).toUpperCase();
252+
} catch (NumberFormatException e) { // Signal uses human-readable color name
253+
return value;
254+
}
251255
}
252256

253257
if(fieldName.equals("acceleration_constant")) {

0 commit comments

Comments
 (0)