Skip to content

Commit

Permalink
Don't crash if no image is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 2, 2020
1 parent 92262b1 commit 7b75ee4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/ui/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ func (e *editor) draw(w, h int) image.Image {
}

func (e *editor) updateSizes() {
if e.img == nil {
return
}
e.cacheWidth = e.img.Bounds().Dx() * e.zoom
e.cacheHeight = e.img.Bounds().Dy() * e.zoom

Expand Down
2 changes: 1 addition & 1 deletion internal/ui/raster.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (r *interactiveRaster) CreateRenderer() fyne.WidgetRenderer {
}

func (r *interactiveRaster) Tapped(ev *fyne.PointEvent) {
if r.edit.tool == nil {
if r.edit.tool == nil || r.edit.img == nil {
return
}

Expand Down

0 comments on commit 7b75ee4

Please sign in to comment.