fix(frontends/lean/elaborator): potential memory access violation

Before this commit, the modified method would crash if caching in the
whnf procedure was disabled.
This commit is contained in:
Leonardo de Moura 2015-03-10 10:12:40 -07:00
parent 1c55e2f389
commit 71ce207080

View file

@ -434,7 +434,7 @@ pair<expr, expr> elaborator::ensure_fun(expr f, constraint_seq & cs) {
bool elaborator::has_coercions_from(expr const & a_type) {
try {
expr const & a_cls = get_app_fn(whnf(a_type).first);
expr a_cls = get_app_fn(whnf(a_type).first);
return is_constant(a_cls) && ::lean::has_coercions_from(env(), const_name(a_cls));
} catch (exception&) {
return false;