mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 16:13:56 +08:00
Merge pull request #2705 from swordqiu/automated-cherry-pick-of-#2703-upstream-release-2.11
Automated cherry pick of #2703: fix: guest get host nil pointer panic
This commit is contained in:
@@ -686,7 +686,9 @@ func (guest *SGuest) CustomizeCreate(ctx context.Context, userCred mcclient.Toke
|
||||
func (guest *SGuest) GetHost() *SHost {
|
||||
if len(guest.HostId) > 0 && regutils.MatchUUID(guest.HostId) {
|
||||
host, _ := HostManager.FetchById(guest.HostId)
|
||||
return host.(*SHost)
|
||||
if host != nil {
|
||||
return host.(*SHost)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user