mirror of
https://github.com/vanitasvitae/Spherical
synced 2024-12-22 02:48:00 +01:00
Fix NPE
This commit is contained in:
parent
94c7d8c540
commit
a497955836
2 changed files with 21 additions and 6 deletions
|
@ -169,32 +169,45 @@ public class PhotoSphereParser {
|
|||
|
||||
private static Integer parseInteger(String key, String xmp, Integer defaultValue) {
|
||||
String value = parseString(key, xmp);
|
||||
return value == null ? defaultValue : Integer.parseInt(value);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Integer.parseInt(value);
|
||||
|
||||
}
|
||||
|
||||
private static Float parseFloat(String key, String xmp, Float defaultValue) {
|
||||
String value = parseString(key, xmp);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return Float.parseFloat(value);
|
||||
}
|
||||
return Float.parseFloat(value);
|
||||
|
||||
}
|
||||
|
||||
private static Boolean parseBoolean(String key, String xmp, Boolean defaultValue) {
|
||||
String value = parseString(key, xmp);
|
||||
return value == null ? defaultValue : Boolean.parseBoolean(value);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
|
||||
private static ProjectionType parseType(String key, String xmp, ProjectionType defaultValue) {
|
||||
String value = parseString(key, xmp);
|
||||
return value == null ? defaultValue : ProjectionType.equirectangular;
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ProjectionType.equirectangular;
|
||||
}
|
||||
|
||||
private static Date parseDate(String key, String xmp, Date defaultValue) {
|
||||
String value = parseString(key, xmp);
|
||||
try {
|
||||
return value == null ? defaultValue : dateFormat.parse(value);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return dateFormat.parse(value);
|
||||
} catch (ParseException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
|
2
app/src/main/res/values-v21/styles.xml
Normal file
2
app/src/main/res/values-v21/styles.xml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
Loading…
Reference in a new issue