Check if the component is associated with the caret before calling methods from it. Added test case that will make sure that will not happen again.
------------- Commit messages: - 8301989: new javax.swing.text.DefaultCaret().setBlinkRate(N) results in NPE Changes: https://git.openjdk.org/jdk20/pull/122/files Webrev: https://webrevs.openjdk.org/?repo=jdk20&pr=122&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8301989 Stats: 48 lines in 2 files changed: 46 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk20/pull/122.diff Fetch: git fetch https://git.openjdk.org/jdk20 pull/122/head:pull/122 PR: https://git.openjdk.org/jdk20/pull/122