summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene.c9
-rw-r--r--viewport.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/scene.c b/scene.c
index 6abae09..cb890a5 100644
--- a/scene.c
+++ b/scene.c
@@ -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);
diff --git a/viewport.c b/viewport.c
index 7f963a8..9feffaa 100644
--- a/viewport.c
+++ b/viewport.c
@@ -52,6 +52,8 @@ mkviewport(Rectangle r)
void
rmviewport(Viewport *v)
{
+ if(v == nil)
+ return;
rmfbctl(v->fbctl);
free(v);
}