diff options
author | rodri <rgl@antares-labs.eu> | 2024-04-03 16:17:48 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-04-03 16:17:48 +0000 |
commit | e05e6c6e71fe60cf663ab563f75b17365ad94665 (patch) | |
tree | 47f4cc76220cf52ec6cbe74eaa1bfc74c22380f0 | |
parent | 930e09a2ea12275cf2e04577a170a2be342db045 (diff) | |
download | libgraphics-e05e6c6e71fe60cf663ab563f75b17365ad94665.tar.gz libgraphics-e05e6c6e71fe60cf663ab563f75b17365ad94665.tar.bz2 libgraphics-e05e6c6e71fe60cf663ab563f75b17365ad94665.zip |
add trivial nil checks to some of the cleanup procedures.
-rw-r--r-- | scene.c | 9 | ||||
-rw-r--r-- | viewport.c | 2 |
2 files changed, 10 insertions, 1 deletions
@@ -117,6 +117,8 @@ newmodel(void) void delmodel(Model *m) { + if(m == nil) + return; if(m->obj != nil) objfree(m->obj); if(m->tex != nil) @@ -146,7 +148,10 @@ newentity(Model *m) void delentity(Entity *e) { - delmodel(e->mdl); + if(e == nil) + return; + if(e->mdl != nil) + delmodel(e->mdl); free(e); } @@ -176,6 +181,8 @@ newscene(char *name) void delscene(Scene *s) { + if(s == nil) + return; clearscene(s); free(s->name); free(s); @@ -52,6 +52,8 @@ mkviewport(Rectangle r) void rmviewport(Viewport *v) { + if(v == nil) + return; rmfbctl(v->fbctl); free(v); } |