getEventCount() works, getEventList() does not

Hi, I’m trying to get a list of events associated with a bank by using getEventList. If I use getEventCount, the returned value is correct but getEventList always returns 0 for both the count and the array. Why could this be happening?

The code:

FMOD::Studio::Bank* sfxBank;
result = system_->loadBankFile("assets/audio/banks/SFX.bank", FMOD_STUDIO_LOAD_BANK_NORMAL, &sfxBank); // Load bank into FMOD api

int eCount;
FMOD::Studio::EventDescription** eventList = nullptr;
//sfxBank->getEventCount(&eCount);
sfxBank->getEventList(eventList, 512, &eCount);

result: eCount = 0 and eventList is still NULL

I have also tried to use getStringInfo() for the same purpose and I get the same behavior.
Any ideas why this is happening?
Is there a better way to get a list of all event names?
Thanks.

I think the problem is due to undefined behaviour resulting from giving eventList a default value of nullptr- this crashes on my compiler which is trying to protect me from writing to the nullptr address. To get this to work you either need to initialise eventList with a pointer to nullptr that isn’t also nullptr (not recommended, but demonstrates the problem)

    int c1, c2;
    sfxBank->getEventCount(&c1);
    FMOD::Studio::EventDescription *nothing = nullptr;
    FMOD::Studio::EventDescription **eventList = &nothing;
    sfxBank->getEventList(eventList, 512, &c2);

Or you need to change EventDescription to a single pointer and pass its address to getEventList (recommneded)

    int c1, c2;
    sfxBank->getEventCount(&c1);
    FMOD::Studio::EventDescription *eventList = nullptr;
    sfxBank->getEventList(&eventList, 512, &c2);

If that doesn’t solve the problem, can you please tell me what your version of FMOD is so I can try to reproduce the issue?

Im on 2.01. It seems that your answer solved part of it (single pointer, use the address of). If I insert a breakpoint right after the call, I can see the correct value and an address for eventList, however, when the function returns I get an exception “the stack around variable eventList was corrupted.”

Double checking the docs I see that eventList is supposed to be an array. Can you please see if this works for you?

int count;
sfxBank->getEventCount(&count);
FMOD::Studio::EventDescription* eventList[512];
sfxBank->getEventList(&*eventList, 512, &count);

for (int i = 0; i < count; ++i)
{
    char path[512];
    int *retrieved = nullptr;
    eventList[i]->getPath(path, 512, retrieved);
    Common_Draw(path);
}

Can you also please tell me what minor version you are on? e.g 2.01.09, 2.01.12?

FMOD::Studio::EventDescription* eventList[512];
sfxBank->getEventList(&*eventList, 512, &count);

That did the trick, thanks. I guess that makes sense but a small example in the docs would be nice for that kind of thing.
Thanks again.