mirror of https://github.com/jetkvm/kvm.git
fix: prevent nil pointer dereference when stopping timers in Close method
This commit is contained in:
parent
b1f345db70
commit
8681d1ffa0
|
@ -165,7 +165,9 @@ func (u *UsbGadget) Close() error {
|
|||
// Stop auto-release timer
|
||||
u.kbdAutoReleaseLock.Lock()
|
||||
for _, timer := range u.kbdAutoReleaseTimers {
|
||||
timer.Stop()
|
||||
if timer != nil {
|
||||
timer.Stop()
|
||||
}
|
||||
}
|
||||
u.kbdAutoReleaseTimers = make(map[byte]*time.Timer)
|
||||
u.kbdAutoReleaseLock.Unlock()
|
||||
|
|
Loading…
Reference in New Issue