diff --git a/client/src/org/compiere/grid/ed/AutoCompletion.java b/client/src/org/compiere/grid/ed/AutoCompletion.java
index 7e8f428e7d..5fd9897b88 100644
--- a/client/src/org/compiere/grid/ed/AutoCompletion.java
+++ b/client/src/org/compiere/grid/ed/AutoCompletion.java
@@ -33,6 +33,7 @@ import org.compiere.swing.CComboBox;
*
BF [ 1735043 ] AutoCompletion: drop down box is showed even if i press Caps
* FR [ 1820783 ] AutoCompletion: posibility to toggle strict mode
* BF [ 1820778 ] ESC(cancel editing) key not working if you are on VComboBox
+ * BF [ 1898001 ] AutoComplete: Exception when selecting a text
* FR [ 2552854 ] Combobox AutoCompletion should ignore diacritics
*/
public class AutoCompletion extends PlainDocument {
@@ -225,6 +226,8 @@ public class AutoCompletion extends PlainDocument {
private void highlightCompletedText(int start) {
editor.setCaretPosition(getLength());
+ if (getLength() < start)
+ start = getLength();
editor.moveCaretPosition(start);
}