Skip to content

Comments

Fix the NPE caused by moduleInfo.packageName()#438

Merged
nipunayf merged 1 commit intoballerina-platform:1.2.xfrom
nipunayf:fix-is-local
Oct 26, 2025
Merged

Fix the NPE caused by moduleInfo.packageName()#438
nipunayf merged 1 commit intoballerina-platform:1.2.xfrom
nipunayf:fix-is-local

Conversation

@nipunayf
Copy link
Contributor

Purpose

$title as it lacks a null check.

Fixes wso2/product-ballerina-integrator#1606

Copilot AI review requested due to automatic review settings October 26, 2025 11:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a NullPointerException (NPE) by adding proper null checks for moduleInfo.packageName() in the isLocal() method. The fix restructures the logic to handle null values defensively and provides a fallback to moduleName when packageName is null.

Key Changes:

  • Inverted the initial null check to use early return pattern
  • Added null check for packageName before calling startsWith()
  • Introduced fallback logic using moduleName when packageName is null

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nipunayf nipunayf merged commit 1a9b72b into ballerina-platform:1.2.x Oct 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants