Skip to content

fix(intellij): project graph or project graph nodes may be null if project is misconfigured #2584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

piotrtomiak
Copy link
Contributor

No description provided.

@piotrtomiak piotrtomiak requested a review from MaxKless as a code owner June 24, 2025 09:58
Copy link

nx-cloud bot commented Jun 24, 2025

View your CI Pipeline Execution ↗ for commit ddfa38e.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e-ci,ty... ✅ Succeeded 9m 46s View ↗
nx-cloud record -- yarn nx sync:check ✅ Succeeded 3s View ↗
nx-cloud record -- ./gradlew :intellij:ktfmtCheck ✅ Succeeded 3s View ↗
nx-cloud record -- ./gradlew projectReportAll ✅ Succeeded 34s View ↗
nx affected --targets=build,test,e2e-ci --confi... ✅ Succeeded 20m 15s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-25 07:55:02 UTC

@MaxKless
Copy link
Collaborator

thanks for the PR! something went wrong with the formatting, just running npx nx ktfmtFormat intellij should fix it

@@ -115,7 +115,7 @@ class NxToolWindowPanel(private val project: Project) : SimpleToolWindowPanel(tr
it.second
}
}
} else if (workspace == null || workspace.projectGraph.nodes.isEmpty()) {
} else if (workspace == null || workspace.projectGraph?.nodes.isNullOrEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The expression workspace.projectGraph?.nodes.isNullOrEmpty() has a potential null safety issue. When projectGraph is null, the safe call operator (?.) prevents a null pointer exception, but the nodes property is still accessed without null safety.

For proper null safety handling, this should be changed to:

workspace.projectGraph?.nodes?.isNullOrEmpty() ?: true

This ensures that when projectGraph is null, the entire expression evaluates to true (equivalent to nodes being empty), preventing potential runtime errors.

Suggested change
} else if (workspace == null || workspace.projectGraph?.nodes.isNullOrEmpty()) {
} else if (workspace == null || workspace.projectGraph?.nodes?.isNullOrEmpty() ?: true) {

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@MaxKless MaxKless merged commit 6d7484c into nrwl:master Jun 25, 2025
6 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