diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 90bf9d815..aadfab0c5 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1505,12 +1505,10 @@ report_computer(const char * filename, report_context * ctx, const char * charse } for (a=a_find(f->attribs, &at_showitem);a && a->type==&at_showitem;a=a->next) { const potion_type * ptype = resource2potion(((const item_type*)a->data.v)->rtype); - requirement * m; const char * ch; const char * description = NULL; if (ptype==NULL) continue; - m = ptype->itype->construction->materials; ch = resourcename(ptype->itype->rtype, 0); fprintf(F, "TRANK %d\n", hashstring(ch)); fprintf(F, "\"%s\";Name\n", add_translation(ch, locale_string(f->locale, ch))); @@ -1523,12 +1521,16 @@ report_computer(const char * filename, report_context * ctx, const char * charse } fprintf(F, "\"%s\";Beschr\n", description); - fprintf(F, "ZUTATEN\n"); + if (ptype->itype->construction) { + requirement * m = ptype->itype->construction->materials; - while (m->number) { - ch = resourcename(m->rtype, 0); - fprintf(F, "\"%s\"\n", add_translation(ch, locale_string(f->locale, ch))); - m++; + fprintf(F, "ZUTATEN\n"); + + while (m->number) { + ch = resourcename(m->rtype, 0); + fprintf(F, "\"%s\"\n", add_translation(ch, locale_string(f->locale, ch))); + m++; + } } } diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 51332eed5..36c14bbcd 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2174,11 +2174,9 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars for (a=a_find(f->attribs, &at_showitem);a && a->type==&at_showitem;a=a->next) { const potion_type * ptype = resource2potion(((const item_type*)a->data.v)->rtype); const char * description = NULL; - requirement * m; if (ptype!=NULL) { const char * pname = resourcename(ptype->itype->rtype, 0); - m = ptype->itype->construction->materials; if (ch==0) { rnl(F); centre(F, LOC(f->locale, "section_newpotions"), true); @@ -2195,13 +2193,17 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars size = sizeof(buf) - 1; bytes = snprintf(bufp, size, "%s: ", LOC(f->locale, "nr_herbsrequired")); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); - while (m->number) { - bytes = (int)strlcpy(bufp, LOC(f->locale, resourcename(m->rtype, 0)), size); - if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); - ++m; - if (m->number) - bytes = (int)strlcpy(bufp, ", ", size); - if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); + + if (ptype->itype->construction) { + requirement * m = ptype->itype->construction->materials; + while (m->number) { + bytes = (int)strlcpy(bufp, LOC(f->locale, resourcename(m->rtype, 0)), size); + if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); + ++m; + if (m->number) + bytes = (int)strlcpy(bufp, ", ", size); + if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); + } } *bufp = 0; centre(F, buf, true);