Make character_ptr tolerate nullptr in constructor

character_ptr::character_ptr(Character *) produced a crash if being
passed a nullptr. This has been fixed. Also when the internal id is 0,
instead of searching a pointer, nullptr is now immediately returned
by character_ptr::getPointerFromId().