summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-02-02 00:15:19 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-02-02 15:47:50 +0900
commitc09f5ee344ae5e6edb827b177bc6a5c2df37e805 (patch)
treefbc29fd8c77309c47854e9c5ec6f3d9a68b51aac /ext/objspace
parent7899046315321f78fa95ef92f313afa86f4d962b (diff)
merge revision(s) 6ca3d1af3302f722aed530764d07c1cc83e95ecf: [Backport #17552]
objspace_dump.c: Handle allocation path and line missing --- ext/objspace/objspace_dump.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace_dump.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
index 7a5f44aaad..544d11e254 100644
--- a/ext/objspace/objspace_dump.c
+++ b/ext/objspace/objspace_dump.c
@@ -471,10 +471,15 @@ dump_object(VALUE obj, struct dump_config *dc)
dump_append(dc, "]");
if (ainfo) {
- dump_append(dc, ", \"file\":\"");
- dump_append(dc, ainfo->path);
- dump_append(dc, "\", \"line\":");
- dump_append_lu(dc, ainfo->line);
+ if (ainfo->path) {
+ dump_append(dc, ", \"file\":\"");
+ dump_append(dc, ainfo->path);
+ dump_append(dc, "\"");
+ }
+ if (ainfo->line) {
+ dump_append(dc, ", \"line\":");
+ dump_append_lu(dc, ainfo->line);
+ }
if (RTEST(ainfo->mid)) {
VALUE m = rb_sym2str(ainfo->mid);
dump_append(dc, ", \"method\":");