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

Co-authored-by: glzjin <glzjin2015@gmail.com>
This commit is contained in:
Zexi Li
2025-06-17 11:15:22 +08:00
committed by GitHub
co-authored by glzjin
parent 2325bc601c
commit 1aa70f504a
+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" {