mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-07-27 17:41:49 +03:00
Set id and loose_extra fields no matter what
The PR #1278 seems to have introduced a segfault. When an empty music track is found, it skips past `id` (and `loose_extra`) being set. Functions which use `id` expect a string, not NULL, causing a crash whenever `isextra` is called, which happens to be every time the `music` or `play` commands are invoked. This fix simply moves the setting of these variables upwards, BEFORE the valid check, to make sure they're always set.
This commit is contained in:
@@ -381,6 +381,10 @@ public:
|
|||||||
MusicTrack(SDL_RWops *rw, const char* _id, bool _loose_extra)
|
MusicTrack(SDL_RWops *rw, const char* _id, bool _loose_extra)
|
||||||
{
|
{
|
||||||
SDL_zerop(this);
|
SDL_zerop(this);
|
||||||
|
|
||||||
|
id = SDL_strdup(_id);
|
||||||
|
loose_extra = _loose_extra;
|
||||||
|
|
||||||
if (rw->size(rw) <= 1)
|
if (rw->size(rw) <= 1)
|
||||||
{
|
{
|
||||||
// Don't bother
|
// Don't bother
|
||||||
@@ -393,9 +397,6 @@ public:
|
|||||||
stb_vorbis_info vorbis_info;
|
stb_vorbis_info vorbis_info;
|
||||||
stb_vorbis_comment vorbis_comment;
|
stb_vorbis_comment vorbis_comment;
|
||||||
|
|
||||||
id = SDL_strdup(_id);
|
|
||||||
|
|
||||||
loose_extra = _loose_extra;
|
|
||||||
vorbis = stb_vorbis_open_memory(read_buf, rw->size(rw), &err, NULL);
|
vorbis = stb_vorbis_open_memory(read_buf, rw->size(rw), &err, NULL);
|
||||||
if (vorbis == NULL)
|
if (vorbis == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user