fix: avoid NPE when closing terminal with null masterOutput#1813
Conversation
When a LineDisciplineTerminal is created with a null masterOutput (e.g. via TerminalBuilder.builder().system(false).build()), closing the terminal triggers a NullPointerException in FilteringOutputStream's flush() and close() methods. Add null guards for masterOutput in all code paths.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFixed a NullPointerException when closing a terminal with a null master output stream by adding null checks to guard flush and close operations in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
…1813) When a LineDisciplineTerminal is created with a null masterOutput (e.g. via TerminalBuilder.builder().system(false).build()), closing the terminal triggers a NullPointerException in FilteringOutputStream's flush() and close() methods. Add null guards for masterOutput in all code paths.
…1813) When a LineDisciplineTerminal is created with a null masterOutput (e.g. via TerminalBuilder.builder().system(false).build()), closing the terminal triggers a NullPointerException in FilteringOutputStream's flush() and close() methods. Add null guards for masterOutput in all code paths.
…1813) When a LineDisciplineTerminal is created with a null masterOutput (e.g. via TerminalBuilder.builder().system(false).build()), closing the terminal triggers a NullPointerException in FilteringOutputStream's flush() and close() methods. Add null guards for masterOutput in all code paths.



Fixes #1796
Summary
masterOutputinLineDisciplineTerminal.FilteringOutputStream.flush()andclose()to prevent NPE when closing a terminal created withsystem(false)and no output streamprocessOutputByte(),processInputByte(), andprocessInputBytes()for completenessExternalTerminalwith nullmasterOutputdoes not throwSummary by CodeRabbit
Release Notes
Bug Fixes
Tests