Skip to content

Commit

Permalink
Merge pull request #43 from veertuinc/3.0.1
Browse files Browse the repository at this point in the history
prevent panic: assignment to entry in nil map when no Arch for instance
  • Loading branch information
NorseGaud authored Aug 7, 2024
2 parents 35db4a7 + af8ac8d commit 28611c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is an example goreleaser.yaml file with some defaults.
# Make sure to check the documentation at http://goreleaser.com
version: 2
version: 1
env:
- CGO_ENABLED=0
before:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.1
4 changes: 3 additions & 1 deletion src/metrics/instance_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ func (ism InstanceStateMetric) GetEventHandler() func(interface{}) error {
}
var archStateMap = intMapFromTwoStringSlices(types.Architectures, types.InstanceStates)
for _, instance := range instances {
archStateMap[instance.Vm.Arch][instance.Vm.State] = archStateMap[instance.Vm.Arch][instance.Vm.State] + 1
if instance.Vm.Arch != "" && instance.Vm.State != "" { // prevent panic: assignment to entry in nil map when no Arch for instance
archStateMap[instance.Vm.Arch][instance.Vm.State] = archStateMap[instance.Vm.Arch][instance.Vm.State] + 1
}
}
for _, arch := range types.Architectures {
for _, state := range types.InstanceStates {
Expand Down

0 comments on commit 28611c7

Please sign in to comment.