Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > bd2e76b227259d8538b18410ed47104a > files > 8

java-1.8.0-openjfx-1.8.0.152-1.b16.2.mga6.src.rpm

Description: JDK-8185792: Entering accents in a textfield on a JFXPanel produces NPE
Origin: backport, http://hg.openjdk.java.net/openjfx/10-dev/rt/rev/ef0ec553083f
Bug: https://bugs.openjdk.java.net/browse/JDK-8185792
Bug-Debian: https://bugs.debian.org/872619
--- a/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
+++ b/modules/swing/src/main/java/javafx/embed/swing/JFXPanel.java
@@ -640,11 +640,15 @@
     private void sendInputMethodEventToFX(InputMethodEvent e) {
         String t = InputMethodSupport.getTextForEvent(e);
 
+        int insertionIndex = 0;
+        if (e.getCaret() != null) {
+            insertionIndex = e.getCaret().getInsertionIndex();
+        }
         scenePeer.inputMethodEvent(
                 javafx.scene.input.InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                 InputMethodSupport.inputMethodEventComposed(t, e.getCommittedCharacterCount()),
                 t.substring(0, e.getCommittedCharacterCount()),
-                e.getCaret().getInsertionIndex());
+                insertionIndex);
     }