Fixed a possible segmentation fault in a non-happy path