X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcclptree.c;h=0f3be4dadc07dbd6a7e8e23e44144088fbd4dd03;hb=3b792849c676d96918850e2f1e0af87a75278501;hp=8c480db6845673398b7bcf6e3d65f15377fe117d;hpb=544ac779d4c6b5d3d07f54486a7cb851bd6f74ea;p=yaz-moved-to-github.git diff --git a/src/cclptree.c b/src/cclptree.c index 8c480db..0f3be4d 100644 --- a/src/cclptree.c +++ b/src/cclptree.c @@ -53,7 +53,7 @@ /* CCL print rpn tree - infix notation * Europagate, 1995 * - * $Id: cclptree.c,v 1.9 2007-04-25 20:50:56 adam Exp $ + * $Id: cclptree.c,v 1.10 2007-05-01 12:12:34 adam Exp $ * * Old Europagate Log: * @@ -135,12 +135,17 @@ static void ccl_pquery_complex(WRBUF w, struct ccl_rpn_node *p, int indent) static void ccl_prterm(WRBUF w, const char *term) { - const char *cp = term; - for (; *cp; cp++) + if (!*term) + wrbuf_puts(w, "\"\""); + else { - if (*cp == ' ' || *cp == '\\') - wrbuf_putc(w, '\\'); - wrbuf_putc(w, *cp); + const char *cp = term; + for (; *cp; cp++) + { + if (*cp == ' ' || *cp == '\\') + wrbuf_putc(w, '\\'); + wrbuf_putc(w, *cp); + } } wrbuf_puts(w, " "); } @@ -149,6 +154,8 @@ static void ccl_pquery_indent(WRBUF w, struct ccl_rpn_node *p, int indent) { struct ccl_rpn_attr *att; + if (!p) + return; if (indent != -1) { int i;