Avoid crashing with null expressions in debug code

This commit is contained in:
Keith Packard 2003-02-27 07:04:31 +00:00
parent 2d39321f1e
commit 662b879681
1 changed files with 2 additions and 1 deletions

View File

@ -153,7 +153,8 @@ FcOpPrint (FcOp op)
void void
FcExprPrint (const FcExpr *expr) FcExprPrint (const FcExpr *expr)
{ {
switch (expr->op) { if (!expr) printf ("none");
else switch (expr->op) {
case FcOpInteger: printf ("%d", expr->u.ival); break; case FcOpInteger: printf ("%d", expr->u.ival); break;
case FcOpDouble: printf ("%g", expr->u.dval); break; case FcOpDouble: printf ("%g", expr->u.dval); break;
case FcOpString: printf ("\"%s\"", expr->u.sval); break; case FcOpString: printf ("\"%s\"", expr->u.sval); break;