From: Peter Johnson Date: Tue, 21 Nov 2006 08:54:05 +0000 (-0000) Subject: errwarn.c (yasm_warn_fetch): Follow documentation and don't crash if no X-Git-Tag: v0.6.0~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0f4ae3ffb2d507c9c2fda45e0815b778a0b0729;p=yasm errwarn.c (yasm_warn_fetch): Follow documentation and don't crash if no warnings pending and this is called. svn path=/trunk/yasm/; revision=1695 --- diff --git a/libyasm/errwarn.c b/libyasm/errwarn.c index b1f94a01..6825a3d9 100644 --- a/libyasm/errwarn.c +++ b/libyasm/errwarn.c @@ -377,6 +377,12 @@ yasm_warn_fetch(yasm_warn_class *wclass, char **str) { warn *w = STAILQ_FIRST(&yasm_warns); + if (!w) { + *wclass = YASM_WARN_NONE; + *str = NULL; + return; + } + *wclass = w->wclass; *str = w->wstr;