Changed some error checks based on reported gcc conflicts from Ceres Solver user group.

Change-Id: Ic8e8a6ba13eec550325a6e4a421dd4194939fd3f
Merge "Changed some error checks based on reported gcc conflicts from Ceres Solver user group."