Fixed incorrect cast getting float from array

Added test for getting float from array
This commit is contained in:
Ian Lovejoy
2021-04-27 19:03:35 -07:00
parent fa46da45f4
commit 75894086e5
2 changed files with 3 additions and 1 deletions

View File

@@ -326,7 +326,7 @@ public class JSONArray implements Iterable<Object> {
public float getFloat(int index) throws JSONException {
final Object object = this.get(index);
if(object instanceof Number) {
return ((Float)object).floatValue();
return ((Number)object).floatValue();
}
try {
return Float.parseFloat(object.toString());