X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/567646c8da4264d87bb75332789cb457cd105a42..fd128d60264c1d3a4282c707af57b45906654a1c:/sbr/fmt_scan.c diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index de44c44a..879f7716 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -367,11 +367,11 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat) comp = fmt->f_comp; - if (! (comp->c_flags & CF_TRIMMED) && comp->c_text) { - i = strlen(comp->c_text); + if (! (comp->c_flags & CF_TRIMMED) && comp->c_text && + (i = strlen(comp->c_text)) > 0) { if (comp->c_text[i - 1] == '\n' && - strcmp(comp->c_name, "body") != 0 && - strcmp(comp->c_name, "text") != 0) + strcmp(comp->c_name, "body") != 0 && + strcmp(comp->c_name, "text") != 0) comp->c_text[i - 1] = '\0'; comp->c_flags |= CF_TRIMMED; }