mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #2896 from ioito/hotfix/qx-image-cache
fix: avoid nil pointer
This commit is contained in:
@@ -18,6 +18,7 @@ package storageman
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -116,6 +117,9 @@ func (c *SRbdImageCacheManager) PrefetchImageCache(ctx context.Context, data int
|
||||
zone, _ := body.GetString("zone")
|
||||
|
||||
cache := c.AcquireImage(ctx, imageId, zone, srcUrl, format)
|
||||
if cache == nil {
|
||||
return nil, fmt.Errorf("failed to cache image %s.%s", imageId, format)
|
||||
}
|
||||
|
||||
res := map[string]interface{}{
|
||||
"image_id": imageId,
|
||||
|
||||
Reference in New Issue
Block a user