mirror of https://github.com/apache/jclouds.git
JCLOUDS-1381: Fix NPE in GCE DiskURIToImage
This commit is contained in:
parent
50ae6828f5
commit
7aed4bc88c
|
@ -45,9 +45,11 @@ public class DiskURIToImage extends CacheLoader<URI, Optional<Image>> {
|
|||
@Override
|
||||
public Optional<Image> 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);
|
||||
|
|
Loading…
Reference in New Issue