Skip to content

Commit

Permalink
Prevent NPE when service lacks identity (hashicorp#19987)
Browse files Browse the repository at this point in the history
Fixes a null pointer exception if `Alloc.SignIdentities` was called for
any service and any service lacked an identity.

Fixes hashicorp#19986
  • Loading branch information
sorenisanerd authored Feb 22, 2024
1 parent cce72cd commit 14280e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/19986.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
server: Prevent NPE when service lacks identity
```
5 changes: 4 additions & 1 deletion nomad/structs/workload_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ type WIHandle struct {
WorkloadType WorkloadType
}

func (w WIHandle) Equal(o WIHandle) bool {
func (w *WIHandle) Equal(o WIHandle) bool {
if w == nil {
return false
}
return w.IdentityName == o.IdentityName &&
w.WorkloadIdentifier == o.WorkloadIdentifier &&
w.WorkloadType == o.WorkloadType
Expand Down

0 comments on commit 14280e0

Please sign in to comment.