public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] writer: Avoid sigsev on types with no translation unit
@ 2021-09-08 14:28 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2021-09-08 14:28 UTC (permalink / raw)
  To: libabigail

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(-)

diff --git a/src/abg-writer.cc b/src/abg-writer.cc
index f18293dc..4940e755 100644
--- a/src/abg-writer.cc
+++ b/src/abg-writer.cc
@@ -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;
-- 
2.30.0


-- 
		Dodji


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-08 14:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 14:28 [PATCH, applied] writer: Avoid sigsev on types with no translation unit Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).