check for NPE

This commit is contained in:
Grahame Grieve 2023-03-13 05:10:08 +11:00
parent 96f265653e
commit 7b30dc02f9
2 changed files with 8 additions and 2 deletions

View File

@ -84,7 +84,10 @@ public class FmlParser extends ParserBase {
result.makeElement("status").setValue("draft");
}
if (!result.hasChild("id") && result.hasChild("name")) {
result.makeElement("id").setValue(Utilities.makeId(result.getChildValue("name")));
String id = Utilities.makeId(result.getChildValue("name"));
if (!Utilities.noString(id)) {
result.makeElement("id").setValue(id);
}
}
if (!result.hasChild("description") && result.hasChild("title")) {
result.makeElement("description").setValue(Utilities.makeId(result.getChildValue("title")));

View File

@ -665,7 +665,10 @@ public class StructureMapUtilities {
}
}
if (!result.hasId() && result.hasName()) {
result.setId(Utilities.makeId(result.getName()));
String id = Utilities.makeId(result.getName());
if (Utilities.noString(id)) {
result.setId(id);
}
}
if (!result.hasStatus()) {
result.setStatus(PublicationStatus.DRAFT);