mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 12:32:05 +01:00
text: Fix nil pointer dereference in drawGlyph (#1732)
drawGlyph can panic when provided with a nil *ebiten.DrawImageOptions reference. Check that the pointer is not nil before dereferencing.
This commit is contained in:
parent
6efe7cbb8b
commit
e52a933506
@ -61,7 +61,9 @@ func drawGlyph(dst *ebiten.Image, face font.Face, r rune, img *ebiten.Image, dx,
|
|||||||
}
|
}
|
||||||
op2.GeoM.Reset()
|
op2.GeoM.Reset()
|
||||||
op2.GeoM.Translate(float64((dx+b.Min.X)>>6), float64((dy+b.Min.Y)>>6))
|
op2.GeoM.Translate(float64((dx+b.Min.X)>>6), float64((dy+b.Min.Y)>>6))
|
||||||
op2.GeoM.Concat(op.GeoM)
|
if op != nil {
|
||||||
|
op2.GeoM.Concat(op.GeoM)
|
||||||
|
}
|
||||||
dst.DrawImage(img, op2)
|
dst.DrawImage(img, op2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user