eolian_cxx: Fix unit initialization

Summary:
eolian_cxx was segfaulting due to a null unit being passed to
class_get_by_file.

Reviewers: felipealmeida, jpeg, q66

Differential Revision: https://phab.enlightenment.org/D5611
This commit is contained in:
Lauro Moura 2017-12-06 13:10:43 -03:00 committed by Daniel Kolesa
parent eee6fbad78
commit aab5cc03ff
1 changed files with 2 additions and 1 deletions

View File

@ -278,7 +278,8 @@ run(options_type const& opts)
char* dup = strdup(opts.in_files[0].c_str());
char* base = basename(dup);
std::string cpp_types_header;
klass = ::eolian_class_get_by_file(nullptr, base);
opts.unit = (Eolian_Unit*)opts.state;
klass = ::eolian_class_get_by_file(opts.unit, base);
free(dup);
if (klass)
{