Skip to content

Commit 82d7b6b

Browse files
committed
glpclview: Don't crash when init fails, just keep retrying
Signed-off-by: Hector Martin <hector@marcansoft.com>
1 parent 50db38b commit 82d7b6b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/glpclview.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,12 @@ void DrawGLScene()
109109
short *depth = 0;
110110
char *rgb = 0;
111111
uint32_t ts;
112-
freenect_sync_get_depth((void**)&depth, &ts);
113-
freenect_sync_get_rgb((void**)&rgb, &ts);
112+
if (freenect_sync_get_depth((void**)&depth, &ts) < 0)
113+
return;
114+
if (freenect_sync_get_rgb((void**)&rgb, &ts) < 0) {
115+
free(depth);
116+
return;
117+
}
114118

115119
static unsigned int indices[480][640];
116120
static short xyz[480][640][3];

0 commit comments

Comments
 (0)