Merge "hal: avoid dereferencing null pointer"