engine: resources: Fix a possible panic on closed channel

I don't know how often it happens, but we should catch it.
This commit is contained in:
James Shubin
2019-02-01 03:48:24 -05:00
parent 78936c5ce8
commit fc48fda7e5
2 changed files with 12 additions and 3 deletions

View File

@@ -148,7 +148,10 @@ func (obj *PkgRes) Watch() error {
send = true
obj.init.Dirty() // dirty
case event := <-obj.init.Events:
case event, ok := <-obj.init.Events:
if !ok {
return nil
}
if err := obj.init.Read(event); err != nil {
return err
}