From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] location:expand() shouldn't crash when no location manager available
Date: Thu, 10 Jun 2021 10:28:29 +0200 [thread overview]
Message-ID: <87v96m2keq.fsf@redhat.com> (raw)
Hello,
While debugging, I noticed that trying to expand location not yet
associated with any location manager would crash.
This patch fixes that.
* src/abg-ir.cc (location::expand): When no location manager is
present, just expand to an empty location.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-ir.cc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 0f909b3d..f0be0843 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -321,7 +321,16 @@ public:
void
location::expand(std::string& path, unsigned& line, unsigned& column) const
{
- ABG_ASSERT(get_location_manager());
+ if (!get_location_manager())
+ {
+ // We don't have a location manager maybe because this location
+ // was just freshly instanciated. We still want to be able to
+ // expand to default values.
+ path = "";
+ line = 0;
+ column = 0;
+ return;
+ }
get_location_manager()->expand_location(*this, path, line, column);
}
--
2.30.0
--
Dodji
reply other threads:[~2021-06-10 8:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v96m2keq.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).