Don't dereference a null pointer
Merge pull request #287 from Hoikas/null-deref

Don't dereference nullptr (again)