Having trouble using Reconfigure

OS: Windows 2019 Server, 64-bit
SDK: 9.0.20
Driver version: 419.69

Called like this:

encoder->reconfigure(8 * 1000000, 4 * 1000000);
bool Encoder::reconfigure(uint32_t max_bitrate, uint32_t avg_bitrate) {
        NV_ENC_INITIALIZE_PARAMS init_params;
        NV_ENC_CONFIG encodeConfig;
        memset(&encodeConfig, 0, sizeof(encodeConfig));
        memset(&init_params, 0, sizeof(init_params));
        init_params.encodeConfig = &encodeConfig;

        if (!init_params.encodeConfig) {
            printf("Didn't get InitializeParams\n");
            return false;

        memset(&params, 0, sizeof(params));
        params.version = NV_ENC_RECONFIGURE_PARAMS_VER;
        params.forceIDR = 1;
        params.resetEncoder = 1;

        encodeConfig = *(init_params.encodeConfig);

        if (max_bitrate) encodeConfig.rcParams.maxBitRate = max_bitrate;
        if (avg_bitrate) encodeConfig.rcParams.averageBitRate = avg_bitrate;

        params.reInitEncodeParams.encodeConfig = &encodeConfig;

        printf("Set reconfigure params...\n");

        return this->encoder->Reconfigure(&params); // Program terminates

For some reason my program terminates as soon as it hits line 29. Likely due to an Exception thrown that for some reason I cannot see the message for.

I’d love help either understanding (a) why this doesn’t work in the first place or (b) how to get the error log easily to see what happened.