add null check

This commit is contained in:
Akira Yumiyama
2013-05-12 14:15:00 +09:00
parent d39a05e68e
commit 14e1992ed0
+4
View File
@@ -250,6 +250,10 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
}
}
if (home == NULL) {
return mrb_nil_value();
}
if (!mrb_file_is_absolute_path(home)) {
if (argc && strlen(cuser) > 0) {
mrb_raisef(mrb, E_ARGUMENT_ERROR, "non-absolute home of ~%s", cuser);