summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index d812d7fedc..2e465e2d89 100644
--- a/file.c
+++ b/file.c
@@ -2789,7 +2789,7 @@ rb_file_join(ary, sep)
name = StringValueCStr(result);
if (i > 0 && !NIL_P(sep)) {
tail = chompdirsep(name);
- if (isdirsep(RSTRING(tmp)->ptr[0])) {
+ if (RSTRING(tmp)->ptr && isdirsep(RSTRING(tmp)->ptr[0])) {
RSTRING(result)->len = tail - name;
}
else if (!*tail) {