Skip to content

Commit

Permalink
Azure: Fix panic when no computername is set (prometheus#9387)
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
  • Loading branch information
roidelapluie committed Sep 24, 2021
1 parent 3e494ea commit 1681a8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion discovery/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ func mapFromVM(vm compute.VirtualMachine) virtualMachine {
}
}

if vm.VirtualMachineProperties != nil && vm.VirtualMachineProperties.OsProfile != nil {
if vm.VirtualMachineProperties != nil &&
vm.VirtualMachineProperties.OsProfile != nil &&
vm.VirtualMachineProperties.OsProfile.ComputerName != nil {
computerName = *(vm.VirtualMachineProperties.OsProfile.ComputerName)
}

Expand Down

0 comments on commit 1681a8d

Please sign in to comment.