# HG changeset patch # User Matti Hamalainen # Date 1530401692 -10800 # Node ID 0fddc51788ded11cc162a0a800bde6ca810f56c9 # Parent f9fd6b4d29f2cbc6d98ba6a5075f74cda437e7ae Fix writing of JSSMOD for NULL extended instruments. diff -r f9fd6b4d29f2 -r 0fddc51788de tools/xm2jss.c --- a/tools/xm2jss.c Sun Jul 01 00:15:38 2018 +0300 +++ b/tools/xm2jss.c Sun Jul 01 02:34:52 2018 +0300 @@ -612,9 +612,18 @@ // Write extended instruments for (totalSize = index = 0; index < module->nextInstruments; index++) - if (module->extInstruments[index] != NULL) { JSSExtInstrument *einst = module->extInstruments[index]; + JSSExtInstrument tmpEInst; + + if (einst == NULL) + { + einst = &tmpEInst; + memset(&tmpEInst, 0, sizeof(tmpEInst)); + JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, + "Extended instrument #%d NULL!\n", + index); + } // Misc data BOOL ok = @@ -645,12 +654,6 @@ totalSize += sizeof(JSSMODExtInstrument); } - else - { - JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, - "Extended instrument #%d NULL!\n", - index); - } dmMsg(1," * %d Extended Instruments, %d bytes.\n", module->nextInstruments, totalSize);