diff --git a/pkg/compute/models/guest_actions.go b/pkg/compute/models/guest_actions.go index 5ab4cc8793..cca7a00439 100644 --- a/pkg/compute/models/guest_actions.go +++ b/pkg/compute/models/guest_actions.go @@ -1175,7 +1175,10 @@ func (self *SGuest) PerformRebuildRoot(ctx context.Context, userCred mcclient.To func (self *SGuest) GetTemplateId() string { gdc := self.CategorizeDisks() - return gdc.Root.GetTemplateId() + if gdc.Root != nil { + gdc.Root.GetTemplateId() + } + return "" } func (self *SGuest) StartRebuildRootTask(ctx context.Context, userCred mcclient.TokenCredential, imageId string, needStop, autoStart bool, passwd string, resetPasswd bool, allDisk bool) error {