Bug fix in material_value.c

An if is moved to its "right" place. A couple of redundant checks are
eliminated.