ir_reader: Fix some potential NULL pointer dereferences.