gg: handle bad image index
parent
c599a4c7de
commit
40d91cc23b
|
@ -108,6 +108,10 @@ pub fn (mut img Image) init_sokol_image() &Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (ctx &Context) draw_image(x, y, width, height f32, img_ &Image) {
|
pub fn (ctx &Context) draw_image(x, y, width, height f32, img_ &Image) {
|
||||||
|
if img_.id >= ctx.image_cache.len {
|
||||||
|
eprintln('gg: draw_image() bad img id $img_.id (img cache len = $ctx.image_cache.len)')
|
||||||
|
return
|
||||||
|
}
|
||||||
img := ctx.image_cache[img_.id] // fetch the image from cache
|
img := ctx.image_cache[img_.id] // fetch the image from cache
|
||||||
if !img.simg_ok {
|
if !img.simg_ok {
|
||||||
return
|
return
|
||||||
|
|
|
@ -7,12 +7,13 @@ enum CloseTagType {
|
||||||
|
|
||||||
[ref_only]
|
[ref_only]
|
||||||
pub struct Tag {
|
pub struct Tag {
|
||||||
mut:
|
pub mut:
|
||||||
name string = ''
|
name string
|
||||||
attributes map[string]string // attributes will be like map[name]value
|
content string
|
||||||
last_attribute string = ''
|
|
||||||
content string = ''
|
|
||||||
children []&Tag
|
children []&Tag
|
||||||
|
mut:
|
||||||
|
attributes map[string]string // attributes will be like map[name]value
|
||||||
|
last_attribute string
|
||||||
parent &Tag = C.NULL
|
parent &Tag = C.NULL
|
||||||
position_in_parent int = 0
|
position_in_parent int = 0
|
||||||
closed bool = false
|
closed bool = false
|
||||||
|
|
Loading…
Reference in New Issue