CLOUDSTACK-4507: fix NPE when taking snapshot

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a0344132
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a0344132
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a0344132

Branch: refs/heads/4.2
Commit: a0344132b58b6abce54bf3e4981b8913c2552824
Parents: 0cefd6c
Author: Edison Su <[email protected]>
Authored: Mon Aug 26 11:04:28 2013 -0700
Committer: Edison Su <[email protected]>
Committed: Mon Aug 26 11:04:28 2013 -0700

----------------------------------------------------------------------
 .../src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0344132/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index e69881c..7d823a3 100644
--- 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@ -265,7 +265,7 @@ public class SnapshotObject implements SnapshotInfo {
                 this.snapshotStoreDao.update(snapshotStore.getId(), 
snapshotStore);
                 
                 // update side-effect of snapshot operation
-                if(snapshotTO.getVolume().getPath() != null) {
+                if(snapshotTO.getVolume() != null && 
snapshotTO.getVolume().getPath() != null) {
                        VolumeVO vol = 
this.volumeDao.findByUuid(snapshotTO.getVolume().getUuid());
                        if(vol != null) {
                                s_logger.info("Update volume path change due to 
snapshot operation, volume " + vol.getId() + " path: "

Reply via email to