VST2: multiple calls to setLatencySamples()

Hi there, first post here.

I am running into what seems like bug, specific to Reaper’s VST2 interface. I’d like confirmation that I’m respecting JUCE’s API before reporting it to Cockos.

From a vanilla project, compiled as a VST2 (Legacy) plugin, I put this in my prepareToPlay:

void EssaiAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) {
    setLatencySamples(0);
    setLatencySamples(1024);
}

I know it’s not necessary to put these two calls, but is it correct/supposed to run as expected, as far as JUCE is concerned? It crashes Reaper in certain conditions (offline bounce with ffmpeg backend).

Thanks in advance!