eolian: gracefully handle incorrect case of inherit.

If you use "EFl" instead of "Efl", it will find the proper file, but
won't find the type... crashing.

Handle that case and hint the user about it.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-08-16 21:41:26 -03:00
parent 0e35f8454e
commit e3e0a6bd65
1 changed files with 8 additions and 1 deletions

View File

@ -1924,7 +1924,14 @@ _inherit_dep(Eo_Lexer *ls, Eina_Strbuf *buf, Eina_Bool check_inherit,
}
_parse_dep(ls, fname, iname);
const Eolian_Class *dep = eolian_class_get_by_name(iname);
assert(dep != NULL);
if (!dep)
{
char ebuf[PATH_MAX];
eo_lexer_context_restore(ls);
snprintf(ebuf, sizeof(ebuf), "unknown inherit '%s'. Incorrect case?", iname);
eo_lexer_syntax_error(ls, ebuf);
return;
}
if (check_inherit) switch (type)
{
case EOLIAN_CLASS_REGULAR: