Fix potential crash found by smatch.