Skip to content

Commit

Permalink
compiler: add try block to handle then base.slot raises exceptions
Browse files Browse the repository at this point in the history
In Java FFI code there are cases when a missing class will raise an underlying Java error that then causes downstream NPE errors.
This is related to forum topic #2891 where a missing jar was causing underlying Java errors.
  • Loading branch information
briansfrank committed Jul 11, 2023
1 parent a21b6da commit eacec03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compiler/fan/util/CallResolver.fan
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ class CallResolver : CompilerSupport
if (base === ns.error) return null

// attempt to resolve the slot by name
found := base.slot(name)
CSlot? found
try
found = base.slot(name)
catch (Err e)
err("Cannot resolve $name on $base; $e.msg", loc)
if (found == null) return null

// if the resolved slot is on a FFI type then we have to
Expand Down

0 comments on commit eacec03

Please sign in to comment.