Fixed building on Linux, missing materials

hdr.pak was accidentally missing from the build script. This led to a segfault when accessing a NULL pointer in getMaterial().

Fixed the Makefile to include the hdr.pak and also added a sanity check for null pointer.