Skip to content
Snippets Groups Projects
Commit f4a152ed authored by Andreas Schärtl's avatar Andreas Schärtl
Browse files

app: fix: do not crash on empty Meta fields

parent bddf5bf2
Branches
No related tags found
No related merge requests found
......@@ -28,15 +28,15 @@ public class Meta {
public String paratype;
public String getName() {
return this.name;
return this.nonNullString(this.name);
}
public String getSourceref() {
return this.sourceref;
return this.nonNullString(this.sourceref);
}
public String getParatype() {
return this.paratype;
return this.nonNullString(this.paratype);
}
@Override
......@@ -47,4 +47,15 @@ public class Meta {
);
}
/**
* @return Return argument {@code s} if {@code s} is not {@code null}.
* If {@code} s} is {@code null}, return an empty {@code String}.
*/
private String nonNullString(String s) {
if (s == null) {
return "";
} else {
return s;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment