MAINT: fix another wrong NULL check

silences cppcheck error, not a bug as the only caller checks the python
error.