Fix a SIGSEGV
This commit is contained in:
@@ -7,6 +7,7 @@ package ordoor
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
@@ -28,7 +29,8 @@ type Ordoor struct {
|
||||
win *ui.Window
|
||||
|
||||
// Relevant to interface state
|
||||
flow *flow.Flow
|
||||
flow *flow.Flow
|
||||
flowOnce sync.Once
|
||||
|
||||
// FIXME: should be put inside flow
|
||||
// If this is set, we display it instead of flow
|
||||
@@ -178,6 +180,7 @@ func (o *Ordoor) Update(screenX, screenY int) error {
|
||||
}
|
||||
|
||||
func (o *Ordoor) Draw(screen *ebiten.Image) error {
|
||||
|
||||
if pic := o.pic; pic != nil {
|
||||
// Scale the picture to the screen and draw it
|
||||
scaleX := float64(screen.Bounds().Dx()) / float64(pic.Bounds().Dx())
|
||||
@@ -190,7 +193,11 @@ func (o *Ordoor) Draw(screen *ebiten.Image) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return o.flow.Draw(screen)
|
||||
if o.flow != nil {
|
||||
return o.flow.Draw(screen)
|
||||
}
|
||||
|
||||
return nil // Draw() may be called before Update()
|
||||
}
|
||||
|
||||
func (o *Ordoor) Cursor() (*ebiten.Image, *ebiten.DrawImageOptions, error) {
|
||||
|
Reference in New Issue
Block a user