From: Nick Bowler Date: Wed, 10 Jun 2009 22:10:55 +0000 (-0400) Subject: Add simple sanity checks to Engine.Music export. X-Git-Url: https://git.draconx.ca/gitweb/upkg.git/commitdiff_plain/e4d0c035db32adb640129d8b4897bd95789318c7 Add simple sanity checks to Engine.Music export. --- diff --git a/src/engine/music.c b/src/engine/music.c index 0c0cdf8..f095c46 100644 --- a/src/engine/music.c +++ b/src/engine/music.c @@ -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)