Skip to content

Commit b713662

Browse files
authored
Merge pull request #114 from zerginator/master
Fix for normalisationPregain CastException
2 parents bb58870 + c1047df commit b713662

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/src/main/java/xyz/gianlu/librespot/FileConfiguration.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ public boolean preloadEnabled() {
151151

152152
@Override
153153
public float normalisationPregain() {
154-
return config.get("player.normalisationPregain");
154+
float result;
155+
Object raw = config.get("player.normalisationPregain");
156+
157+
if(raw instanceof Double) result = ((Double) raw).floatValue();
158+
else if(raw instanceof Integer) result = ((Integer) raw).floatValue();
159+
else throw new IllegalArgumentException(" normalisationPregain is not a valid number: " + raw.toString());
160+
161+
return result;
155162
}
156163

157164
@NotNull

0 commit comments

Comments
 (0)