Additional null checks to make GCC warnings go away

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>
Some more null checks to make GCC warnings go away

Signed-off-by: Erik de Bruin <erik@ixsoftware.nl>