summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2017-02-01 00:07:58 -0600
committerepoch <epoch@hacking.allowed.org>2017-02-01 00:07:58 -0600
commitf1233b70d415f21a462a06f80d9500f59ede9a98 (patch)
tree8e4ee69d306fe29a0640a9994f7a529dfd285b44
parent16ed36684a8c3dbd62f619c196e2e9b0adabe884 (diff)
downloadhackvr-f1233b70d415f21a462a06f80d9500f59ede9a98.tar.gz
hackvr-f1233b70d415f21a462a06f80d9500f59ede9a98.zip
derped and ended up with negative index... heh.
-rw-r--r--src/graphics.c6
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) {