forked from Imagelibrary/binutils-gdb
Fix printing of global variable stubs if no inferior is running
Since3c45e9f915gdb crashes when trying to print a global variable stub without a running inferior, because of a missing nullptr-check (the block_scope function took care of that check before it was converted to a method). With this check it works again: ``` (gdb) print s $1 = <incomplete type> ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31128 Approved-By: Tom Tromey <tom@tromey.com> (cherry picked from commit576745e26c)
This commit is contained in:
@@ -1026,7 +1026,11 @@ cp_lookup_transparent_type (const char *name)
|
||||
|
||||
/* If that doesn't work and we're within a namespace, look there
|
||||
instead. */
|
||||
scope = get_selected_block (0)->scope ();
|
||||
const block *block = get_selected_block (0);
|
||||
if (block == nullptr)
|
||||
return nullptr;
|
||||
|
||||
scope = block->scope ();
|
||||
|
||||
if (scope[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user