handle null pointer in addPid