fix NULL pointer dereferences and implement some additional safeguards
fix NULL pointer dereferences and implement some additional safeguards

ok marco

conformal/spectrwm,conformal/spectrwm,conformal/spectrwm