aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-parse.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-19 17:37:15 -0700
committerTom Tromey <tom@tromey.com>2023-02-19 12:51:05 -0700
commit683aecac8c37c11d63203c96455a3d9ecf50bbe9 (patch)
treeb6cce224a94fc1f196666c310bfc921705324ca6 /gdb/rust-parse.c
parentf52688890edd7c587ec11cf1d565f235e41a6c43 (diff)
downloadgdb-683aecac8c37c11d63203c96455a3d9ecf50bbe9.zip
gdb-683aecac8c37c11d63203c96455a3d9ecf50bbe9.tar.gz
gdb-683aecac8c37c11d63203c96455a3d9ecf50bbe9.tar.bz2
Don't allow NULL as an argument to block_scope
block_scope has special behavior when the block is NULL. Remove this and patch up the callers instead.
Diffstat (limited to 'gdb/rust-parse.c')
-rw-r--r--gdb/rust-parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 489be4b..72b843e 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -373,7 +373,9 @@ rust_parser::crate_name (const std::string &name)
std::string
rust_parser::super_name (const std::string &ident, unsigned int n_supers)
{
- const char *scope = block_scope (pstate->expression_context_block);
+ const char *scope = "";
+ if (pstate->expression_context_block != nullptr)
+ scope = block_scope (pstate->expression_context_block);
int offset;
if (scope[0] == '\0')