From f6facdaa683e7159b7569d5287a088da352a7c92 Mon Sep 17 00:00:00 2001
From: Andrew Rabert <ar@nullsum.net>
Date: Sat, 11 Jan 2025 00:26:08 -0500
Subject: [PATCH] Fix libxmp playback Fixes crashing when the int16_buffer is
 smaller than the desired len. Particularly, I was seeing the int16_buffer
 with a size of 0.

---
 source/streamsources/music_libxmp.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/streamsources/music_libxmp.cpp b/source/streamsources/music_libxmp.cpp
index e235b06..999e046 100644
--- a/source/streamsources/music_libxmp.cpp
+++ b/source/streamsources/music_libxmp.cpp
@@ -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);
-- 
2.47.1

