Skip to content

GetVirtualMachinesMetricID method throwing panic error when accessing VMs from reponse #103

@rajeshvenkata

Description

@rajeshvenkata

Problem: VirtualMachineService.GetVirtualMachinesMetricID method throws panic when it is trying to access the VMs response from server in below line of code. This happens when the count in the response is 1 but the actual VirtualMachinesMetrics array in the reponse is nil or empty. This is causing panic in the caller CAPC

panic error is happening at: https://github.com/apache/cloudstack-go/blob/main/cloudstack/VirtualMachineService.go#L5543

error: panic: runtime error: index out of range [0] with length 0

version of cloudstack-go used: 2.16.1

Please help investigate this error and let us know if this response is not expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions