S3M: interpret null pointer
and fix crash
This commit is contained in:
parent
b04a2e38db
commit
40e14d88cc
|
@ -317,6 +317,14 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
for (int i=0; i<ds.insLen; i++) {
|
for (int i=0; i<ds.insLen; i++) {
|
||||||
logV("reading instrument %d...",i);
|
logV("reading instrument %d...",i);
|
||||||
DivInstrument* ins=new DivInstrument;
|
DivInstrument* ins=new DivInstrument;
|
||||||
|
if (insPtr[i]==0) {
|
||||||
|
ins->type=DIV_INS_ES5506;
|
||||||
|
ds.ins.push_back(ins);
|
||||||
|
DivSample* emptySample=new DivSample;
|
||||||
|
ds.sample.push_back(emptySample);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!reader.seek(insPtr[i]+0x4c,SEEK_SET)) {
|
if (!reader.seek(insPtr[i]+0x4c,SEEK_SET)) {
|
||||||
logE("premature end of file!");
|
logE("premature end of file!");
|
||||||
lastError="incomplete file";
|
lastError="incomplete file";
|
||||||
|
@ -651,6 +659,8 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
bool arpingOld[32];
|
bool arpingOld[32];
|
||||||
bool did[32];
|
bool did[32];
|
||||||
|
|
||||||
|
if (patPtr[i]==0) continue;
|
||||||
|
|
||||||
logV("reading pattern %d...",i);
|
logV("reading pattern %d...",i);
|
||||||
if (!reader.seek(patPtr[i],SEEK_SET)) {
|
if (!reader.seek(patPtr[i],SEEK_SET)) {
|
||||||
logE("premature end of file!");
|
logE("premature end of file!");
|
||||||
|
@ -778,7 +788,7 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
|
||||||
bool hasEffect=what&128;
|
bool hasEffect=what&128;
|
||||||
|
|
||||||
if (did[chan]) {
|
if (did[chan]) {
|
||||||
logW("pat %d chan %d row %d: we already populated this channel!");
|
logW("pat %d chan %d row %d: we already populated this channel!",i,chan,curRow);
|
||||||
} else {
|
} else {
|
||||||
did[chan]=true;
|
did[chan]=true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue