Skip to content

Commit bd17428

Browse files
committed
fix float crash
1 parent 615527f commit bd17428

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

common/src/main/java/fr/tathan/sky_aesthetics/client/screens/SkyModificationScreen.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,13 @@ public static Optional<Vector4f> getVec4fFromComponent(FlowLayout component) {
360360
}
361361

362362
public static Object convertValue(String str, Class<?> type) {
363+
str = str.isEmpty() ? "-1" : str;
363364
try {
364365
return switch (type.getSimpleName()) {
365366
case "int", "Integer" -> Integer.parseInt(str);
366367
case "long", "Long" -> Long.parseLong(str);
367368
case "double", "Double" -> Double.parseDouble(str);
368-
case "float", "Float" -> Float.parseFloat(str);
369+
case "float", "Float" -> (float) Float.parseFloat(str);
369370
default -> str;
370371
};
371372
} catch (Exception e) {

0 commit comments

Comments
 (0)