diff --git a/src/oplsynth/mlopl_io.cpp b/src/oplsynth/mlopl_io.cpp index 5e2f23e93..4dc15e39f 100644 --- a/src/oplsynth/mlopl_io.cpp +++ b/src/oplsynth/mlopl_io.cpp @@ -68,7 +68,10 @@ void OPLio::OPLwriteReg(int which, uint reg, uchar data) reg |= (which & 1) << 8; which >>= 1; } - chips[which]->WriteReg(reg, data); + if (chips[which] != NULL) + { + chips[which]->WriteReg(reg, data); + } } /* diff --git a/src/oplsynth/opl_mus_player.cpp b/src/oplsynth/opl_mus_player.cpp index df4b3c88e..335e6d66e 100644 --- a/src/oplsynth/opl_mus_player.cpp +++ b/src/oplsynth/opl_mus_player.cpp @@ -411,10 +411,7 @@ int OPLmusicFile::PlayTick () break; default: // It's something to stuff into the OPL chip - if (WhichChip < NumChips) - { - io->OPLwriteReg(WhichChip, reg, data); - } + io->OPLwriteReg(WhichChip, reg, data); break; } } @@ -454,10 +451,7 @@ int OPLmusicFile::PlayTick () { data = *score++; } - if (WhichChip < NumChips) - { - io->OPLwriteReg(WhichChip, reg, data); - } + io->OPLwriteReg(WhichChip, reg, data); } break; @@ -485,7 +479,7 @@ int OPLmusicFile::PlayTick () { return (data + 1) << 8; } - else if (code < to_reg_size && which < NumChips) + else if (code < to_reg_size) { io->OPLwriteReg(which, to_reg[code], data); }