Skip to content

Commit

Permalink
gfx: fix GFXPrimitiveSetFont() segfault when passed a nil fontdata
Browse files Browse the repository at this point in the history
Signed-off-by: Lilis Iskandar <[email protected]>
  • Loading branch information
veeableful committed Jun 27, 2017
1 parent 2f90afa commit 8f34d33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gfx/sdl_gfx.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,10 @@ func BezierRGBA(renderer *sdl.Renderer, vx, vy []int16, s int, r, g, b, a uint8)
}

func GFXPrimitiveSetFont(fontdata []byte, cw, ch uint32) {
_fontdata := unsafe.Pointer(&fontdata[0])
_fontdata := unsafe.Pointer(nil)
if fontdata != nil {
_fontdata = unsafe.Pointer(&fontdata[0])
}
_cw := C.Uint32(cw)
_ch := C.Uint32(ch)
C.gfxPrimitivesSetFont(_fontdata, _cw, _ch)
Expand Down

0 comments on commit 8f34d33

Please sign in to comment.