]> git.draconx.ca Git - upkg.git/commitdiff
Add simple sanity checks to Engine.Music export.
authorNick Bowler <nbowler@draconx.ca>
Wed, 10 Jun 2009 22:10:55 +0000 (18:10 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 10 Jun 2009 22:10:55 +0000 (18:10 -0400)
src/engine/music.c

index 0c0cdf81be1253155ac15e6cd79299ece2d97278..f095c46a8f54bc550ef19e24e20551bae95150ee 100644 (file)
@@ -27,6 +27,9 @@ static int export(GObject *o, FILE *f)
 
        unsigned char buf[1024];
 
+       if (!priv->f)
+               return -1;
+
        if (upkg_export_seek(priv->f, priv->base, SEEK_SET) != 0)
                return -1;
 
@@ -45,8 +48,7 @@ static int export(GObject *o, FILE *f)
 static int export_name(GObject *o, char *buf, size_t n)
 {
        struct music_priv *priv = MUSIC_GET_PRIV(o);
-
-       return snprintf(buf, n, "%s", priv->f->name);
+       return snprintf(buf, n, "%s", priv->f ? priv->f->name : "");
 }
 
 static void exportable_init(UPkgExportable *e)