If modelObject is empty here, it may cause exception later.

Change-Id: I892fdde7dabbf9dc55a74a6722413e260d0eedae
This commit is contained in:
kezhiyong 2019-01-16 06:42:06 +00:00
parent 7d82afc0ae
commit b227781dea

View File

@ -240,6 +240,9 @@ public abstract class TapiObjectHandler<T extends ModelObject> {
if (modelObjectData.modelObjects().size() > 1) {
throw new IllegalStateException("Multiple modelObject found.");
}
if (modelObjectData.modelObjects().isEmpty()) {
throw new IllegalStateException("ModelObject must not be empty.");
}
return (T) modelObjectData.modelObjects().get(0);
}