Check for model validity in GModels::eval.

Fixes bug #1153.