fix: panic when there is no secondary IP on the host. (#22721)

This commit is contained in:
glzjin
2025-06-17 11:14:54 +08:00
committed by GitHub
parent e999914539
commit ba97cee426
+3
View File
@@ -222,6 +222,9 @@ func (s *Service) metaData(ctx context.Context, w http.ResponseWriter, r *http.R
ips := make([]string, 0)
guestNics := guestDesc.Nics
for _, nic := range guestNics {
if nic.Networkaddresses == nil {
continue
}
nas, _ := nic.Networkaddresses.GetArray()
for _, na := range nas {
if typ, _ := na.GetString("type"); typ == "sub_ip" {