Merge "hal:  KW fixes for NULL checks and invalid index"