diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 1f33181ef85965ece5fb1ea8e9afb81b198473ce..d4334dca223c1eca1eeb0e7856ccd3dc740393c5 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1459,6 +1459,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
         goto cleanup;
 
     if (vol->target.format == VIR_STORAGE_FILE_RAW &&
+        vol->target.encryption &&
         vol->target.encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS) {
         if (!(secretPath =
               virStorageBackendCreateQemuImgSecretPath(conn, pool, vol)))