fix(usbgadget): do not panic if a change isn't found (#481)

* fix(usbgadget): do not panic if a change isn't found

* chore(usbgadget): rebind usb after updating config
This commit is contained in:
Aveline
2025-05-20 00:34:32 +02:00
committed by GitHub
parent b4dd4961fc
commit a0f6d01465
3 changed files with 27 additions and 12 deletions

View File

@@ -48,6 +48,11 @@ func (c *ChangeSetResolver) doResolveChanges(initial bool) error {
for _, key := range c.orderedChanges {
change := c.changesMap[key.(string)]
if change == nil {
c.l.Error().Str("key", key.(string)).Msg("fileChange not found")
continue
}
if !initial {
change.ResetActionResolution()
}
@@ -123,7 +128,11 @@ func (c *ChangeSetResolver) applyChanges() error {
err := c.changeset.applyChange(change)
if err != nil {
return err
if change.IgnoreErrors {
c.l.Warn().Str("change", change.String()).Err(err).Msg("ignoring error")
} else {
return err
}
}
}