From f1233b70d415f21a462a06f80d9500f59ede9a98 Mon Sep 17 00:00:00 2001 From: epoch Date: Wed, 1 Feb 2017 00:07:58 -0600 Subject: derped and ended up with negative index... heh. --- src/graphics.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/graphics.c b/src/graphics.c index 49da7d4..0852ec4 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -438,8 +438,10 @@ void draw_screen() { } qsort(&zs,i,sizeof(zs[0]),(__compar_fn_t)compar);//sort these zs structs based on d. } - if(zs[i-1].s) { - strcpy(global.selected_object,zs[i-1].s->id);//0th is farthest. fixme. + if(i > 0) { + if(zs[i-1].s) { + strcpy(global.selected_object,zs[i-1].s->id); + } } //draw all triangles if(global.debug) { -- cgit v1.2.3