Improve error handling in find_center()

This commit is contained in:
hasufell 2014-05-10 22:48:50 +02:00
parent f57dda9094
commit 1b97f290cf
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 6 additions and 1 deletions

View File

@ -59,7 +59,12 @@ HE_vert *find_center(HE_obj const * const obj)
y = 0,
z = 0;
uint32_t i;
HE_vert *newvert = malloc(sizeof(HE_vert));
HE_vert *newvert;
if (!obj)
return NULL;
newvert = malloc(sizeof(HE_vert));
for (i = 0; i < obj->vc; i++) {
x += obj->vertices[i].x;