mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
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