=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/eqn_term.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/mandoc/eqn_term.c 2015/01/01 15:34:43 1.4 +++ src/usr.bin/mandoc/eqn_term.c 2017/02/12 14:13:23 1.5 @@ -1,7 +1,7 @@ -/* $OpenBSD: eqn_term.c,v 1.4 2015/01/01 15:34:43 schwarze Exp $ */ +/* $OpenBSD: eqn_term.c,v 1.5 2017/02/12 14:13:23 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons - * Copyright (c) 2014, 2015 Ingo Schwarze + * Copyright (c) 2014, 2015, 2017 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -66,8 +66,10 @@ if (bp->pos == EQNPOS_SQRT) { term_word(p, "sqrt"); - p->flags |= TERMP_NOSPACE; - eqn_box(p, bp->first); + if (bp->first != NULL) { + p->flags |= TERMP_NOSPACE; + eqn_box(p, bp->first); + } } else if (bp->type == EQN_SUBEXPR) { child = bp->first; eqn_box(p, child); @@ -91,7 +93,8 @@ } } else { child = bp->first; - if (bp->type == EQN_MATRIX && child->type == EQN_LIST) + if (bp->type == EQN_MATRIX && + child != NULL && child->type == EQN_LIST) child = child->first; while (child != NULL) { eqn_box(p,