diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java index 0f98098d08..470cd9eb7c 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/DiskURIToImage.java @@ -45,9 +45,11 @@ public class DiskURIToImage extends CacheLoader> { @Override public Optional load(URI key) throws ExecutionException { try { + Image image = null; Disk disk = resources.disk(key); - URI sourceImage = disk.sourceImage(); - Image image = sourceImage != null ? resources.image(sourceImage) : null; + if (disk != null && disk.sourceImage() != null) { + image = resources.image(disk.sourceImage()); + } return Optional.fromNullable(image); } catch (Exception e) { throw new ExecutionException(message(key, e), e);