Skip to content

Commit

Permalink
Fix libxmp playback
Browse files Browse the repository at this point in the history
Fixes crashing when the int16_buffer is smaller than the desired len.
Particularly, I was seeing the int16_buffer with a size of 0.
  • Loading branch information
nvllsvm committed Jan 11, 2025
1 parent 4cc05f7 commit fbbccef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/streamsources/music_libxmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool XMPSong::SetSubsong(int subsong)

bool XMPSong::GetData(void *buffer, size_t len)
{
if ((len / 4) < int16_buffer.size())
if ((len / 4) > int16_buffer.size())
int16_buffer.resize(len / 4);

int ret = xmp_play_buffer(context, (void*)int16_buffer.data(), len / 2, m_Looping? INT_MAX : 0);
Expand Down

0 comments on commit fbbccef

Please sign in to comment.