Merge "hal: Add NULL checks and fix data initialization errors."