battery: add NULL check routine for input parameter