[applied] location:expand() shouldn't crash when no location manager available
Commit Message
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(-)
@@ -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);
}