diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 47eecafede2da46d4faca2149f641270ec04a164..211b69a443b2d82af4f030e13b4bc1e3a4a91256 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1742,9 +1742,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
                         throw new RuntimeException("Couldn't flip the indicator!");
                     }
                 }
-                final CharSequence textWithUnderline =
-                        getTextWithUnderline(mWordComposer.getTypedWord());
-                if (!TextUtils.isEmpty(textWithUnderline)) {
+                if (mWordComposer.isComposingWord()) {
+                    final CharSequence textWithUnderline =
+                            getTextWithUnderline(mWordComposer.getTypedWord());
                     ic.setComposingText(textWithUnderline, 1);
                 }
             }