Skip to content

Commit 75aa637

Browse files
takaokoujiclaude
andcommitted
fix: add null checks to prevent undefined access in callMethod
- Add null checks for methodToNumArgs and numArgsToNumRubyBlockArgs - Fix 'Cannot read properties of undefined (reading '0')' error - Ensure proper error handling for unknown function calls like 'abc' - Restore proper 'wrong instruction' error messages instead of exceptions This fixes the regression introduced by registerCallMyBlock implementation where undefined function calls would cause exceptions instead of proper error handling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1ee936b commit 75aa637

File tree

1 file changed

+2
-0
lines changed
  • src/lib/ruby-to-blocks-converter

1 file changed

+2
-0
lines changed

src/lib/ruby-to-blocks-converter/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,9 @@ class RubyToBlocksConverter {
395395
}
396396

397397
const methodToNumArgs = this._receiverToMethods[receiverName];
398+
if (!methodToNumArgs) return null;
398399
const numArgsToNumRubyBlockArgs = methodToNumArgs[name];
400+
if (!numArgsToNumRubyBlockArgs) return null;
399401
const numRubyBlockArgsToCreateBlockFuncs = numArgsToNumRubyBlockArgs[args.length];
400402
if (!numRubyBlockArgsToCreateBlockFuncs) return null;
401403

0 commit comments

Comments
 (0)