Skip to content

Commit

Permalink
Check for empty string from ENV.op_aref
Browse files Browse the repository at this point in the history
ENV.op_aref can only return nil or a string (no methods that are
bound to Ruby should ever return null) so check both of those
conditions to determine fallback on default PATH.

Fixes jruby#8289
  • Loading branch information
headius committed Jun 18, 2024
1 parent 02ad2dd commit 4b93cbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/ShellLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public static File findPathExecutable(Ruby runtime, String fname, IRubyObject pa
pathObject = env.op_aref(runtime.getCurrentContext(), RubyString.newString(runtime, PATH_ENV));
}

if (pathObject == null) {
if (pathObject.isNil() || pathObject.convertToString().size() == 0) {
pathNodes = DEFAULT_PATH; // ASSUME: not modified by callee
}

Expand Down

0 comments on commit 4b93cbf

Please sign in to comment.