Matlab S-Function: Why does ssGetInputPortSignal() return NULL?

There are several different reasons why ssGetInputPortSignal() returns NULL or nullptr?

ssgetinput_example.cpp
real_T *input = ssGetInputPortSignal(S, 0);
example.cpp
if (!ssGetInputPortConnected(S, 0)) {
    mexPrintf("Input port 0 is not connected\n");
}

Check out similar posts by category: Matlab/Simulink