Fix an exception - in case VM has no imageUuid
e.g. The VM imported from vCenter doesn't have an imageUuid.
@@ -2164,9 +2164,13 @@ public class VmInstanceBase extends AbstractVmInstance {
}
private void checkImageMediaTypeCapabilities(Map<String, Object> ret) {
- ImageVO vo = dbf.findByUuid(self.getImageUuid(), ImageVO.class);
+ ImageVO vo = null;
ImageMediaType imageMediaType;
+ if (self.getImageUuid() != null) {
+ vo = dbf.findByUuid(self.getImageUuid(), ImageVO.class);
+ }
+
if (vo == null) {
imageMediaType = null;
} else {
