aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6f7d5ed6e4..98448ff1f9 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -22147,16 +22147,18 @@ void func_dump_profile(FILE *fd)
} else {
fprintf(fd, "FUNCTION %s()\n", fp->uf_name);
}
- bool should_free;
- const LastSet last_set = (LastSet){
- .script_ctx = fp->uf_script_ctx,
- .channel_id = 0,
- };
- char_u *p = get_scriptname(last_set, &should_free);
- fprintf(fd, " Defined: %s line %" PRIdLINENR "\n",
- p, fp->uf_script_ctx.sc_lnum);
- if (should_free) {
- xfree(p);
+ if (fp->uf_script_ctx.sc_sid != 0) {
+ bool should_free;
+ const LastSet last_set = (LastSet){
+ .script_ctx = fp->uf_script_ctx,
+ .channel_id = 0,
+ };
+ char_u *p = get_scriptname(last_set, &should_free);
+ fprintf(fd, " Defined: %s line %" PRIdLINENR "\n",
+ p, fp->uf_script_ctx.sc_lnum);
+ if (should_free) {
+ xfree(p);
+ }
}
if (fp->uf_tm_count == 1) {
fprintf(fd, "Called 1 time\n");