ComboBox: more checks for valid model + coding style

Before accessing the model, we have to check whether it is valid at all
in order to avoid a crash.

Closes #273.