diff options
author | epoch <epoch@hacking.allowed.org> | 2017-02-01 00:07:58 -0600 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2017-02-01 00:07:58 -0600 |
commit | f1233b70d415f21a462a06f80d9500f59ede9a98 (patch) | |
tree | 8e4ee69d306fe29a0640a9994f7a529dfd285b44 | |
parent | 16ed36684a8c3dbd62f619c196e2e9b0adabe884 (diff) | |
download | hackvr-f1233b70d415f21a462a06f80d9500f59ede9a98.tar.gz hackvr-f1233b70d415f21a462a06f80d9500f59ede9a98.zip |
derped and ended up with negative index... heh.
-rw-r--r-- | src/graphics.c | 6 |
1 files changed, 4 insertions, 2 deletions
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) { |