[PR #1320] Fix NPE in VmTyped.hashCode when property is null #1016

Open
opened 2025-12-30 01:28:18 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1320
Author: @jurajmaj
Created: 11/15/2025
Status: 🔄 Open

Base: mainHead: npe-in-hashcode


📝 Commits (2)

  • 6ba027a Fix NPE in VmTyped.hashCode when property is null
  • 7a0b32c Use stackOverflowError for circular reference handling in hashCode

📊 Changes

2 files changed (+6 additions, -2 deletions)

View changed files

📝 pkl-core/src/main/java/org/pkl/core/runtime/VmExceptionBuilder.java (+5 -1)
📝 pkl-core/src/main/java/org/pkl/core/runtime/VmTyped.java (+1 -1)

📄 Description

Fixes #1167

Null properties in VmTyped previously caused a NPE when accessed through hashCode().
This fix adds null checks so that containsKey and other map operations do not crash.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/1320 **Author:** [@jurajmaj](https://github.com/jurajmaj) **Created:** 11/15/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `npe-in-hashcode` --- ### 📝 Commits (2) - [`6ba027a`](https://github.com/apple/pkl/commit/6ba027aa5038507cbb403bd1db9c767a73078a7b) Fix NPE in VmTyped.hashCode when property is null - [`7a0b32c`](https://github.com/apple/pkl/commit/7a0b32c7129c6a49b8351ab509d5267c871e9167) Use stackOverflowError for circular reference handling in hashCode ### 📊 Changes **2 files changed** (+6 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `pkl-core/src/main/java/org/pkl/core/runtime/VmExceptionBuilder.java` (+5 -1) 📝 `pkl-core/src/main/java/org/pkl/core/runtime/VmTyped.java` (+1 -1) </details> ### 📄 Description Fixes #1167 Null properties in `VmTyped` previously caused a NPE when accessed through `hashCode()`. This fix adds null checks so that `containsKey` and other map operations do not crash. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:28:18 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#1016