From b146e5d1b4a98b9eadc9cf385617b33ca88f44fa Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 24 Jul 2016 00:02:45 +0900 Subject: [PATCH] graphics: Bug fix: Errors should be returned after checking the history --- pixels.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pixels.go b/pixels.go index b378ccb23..73aadfd0f 100644 --- a/pixels.go +++ b/pixels.go @@ -92,15 +92,15 @@ func (p *pixels) hasHistoryWith(target *Image) bool { } func (p *pixels) resetHistoryIfNeeded(image *graphics.Image, target *Image, context *opengl.Context) error { - if context == nil { - return errors.New("ebiten: OpenGL context is missing: before running the main loop, it is forbidden to manipulate images that is used as a drawing source once.") - } if p.drawImageHistory == nil { return nil } if !p.hasHistoryWith(target) { return nil } + if context == nil { + return errors.New("ebiten: OpenGL context is missing: before running the main loop, it is forbidden to manipulate images that is used as a drawing source once.") + } var err error p.basePixels, err = image.Pixels(context) if err != nil {