Skip to content

Commit

Permalink
adding check for oldobjectreturn
Browse files Browse the repository at this point in the history
  • Loading branch information
gizas committed Jan 9, 2024
1 parent 9ee164e commit 328f78d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ func (w *watcher) enqueue(obj interface{}, state string) {

// oldobjectreturn returns the old version of cache objects before change on update events
func (w *watcher) oldobjectreturn(o interface{}) {
w.oldobject = o.(runtime.Object)
if old, ok := o.(runtime.Object); !ok {
utilruntime.HandleError(fmt.Errorf("expected object in cache got %#v", o))
} else {
w.oldobject = old
}
}

// process gets the top of the work queue and processes the object that is received.
Expand Down

0 comments on commit 328f78d

Please sign in to comment.