internal/ui: bug fix: atomic.Value.Store cannot be called when a differnet type value is already stored

This commit is contained in:
Hajime Hoshi 2022-02-27 17:41:19 +09:00
parent 566957dc1c
commit 1cb7633ff6
2 changed files with 6 additions and 1 deletions

View File

@ -395,6 +395,8 @@ func (p *playerImpl) readSourceToBuffer() {
} }
func (p *playerImpl) setErrorImpl(err error) { func (p *playerImpl) setErrorImpl(err error) {
p.err.Store(err) if p.err.Load() == nil {
p.err.Store(err)
}
p.closeImpl() p.closeImpl()
} }

View File

@ -185,6 +185,9 @@ func (g *globalState) err() error {
} }
func (g *globalState) setError(err error) { func (g *globalState) setError(err error) {
if g.err_.Load() != nil {
return
}
g.err_.Store(err) g.err_.Store(err)
} }