Check data != nullptr on all code paths

Signed-off-by: Sven Strickroth <email@cs-ware.de>