[applied] writer: Avoid sigsev on types with no translation unit
Commit Message
Hello,
referenced_type_should_be_emitted should not crash on types with
associated translation unit, like e.g, "void type".
Fixed thus.
* src/abg-writer.cc (referenced_type_should_be_emitted): Don't
crash on types with no associated translation unit.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-writer.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -2263,8 +2263,9 @@ referenced_type_should_be_emitted(const type_base *t,
const translation_unit& tu,
bool tu_is_last)
{
- if ((tu_is_last || t->get_translation_unit()->get_absolute_path()
- == tu.get_absolute_path())
+ if ((tu_is_last || (t->get_translation_unit()
+ && (t->get_translation_unit()->get_absolute_path()
+ == tu.get_absolute_path())))
&& !ctxt.type_is_emitted(t)
&& !ctxt.decl_only_type_is_emitted(t))
return true;