NetLogo/NetLogo — Issue #89: BadLocationException when using undo and redo
Author: SethTisue
Created: 2012-02-21 17:36:02+00:00
State: open

Ken Kahn writes:

>Prior to the following I had typed control-z a few times followed by control-y and it wasn't properly undoing/redoing. Then I got this

```text
java.lang.IllegalStateException: javax.swing.text.BadLocationException:
Length must be positive
at org.nlogo.editor.HighlightView.drawLine(HighlightView.java:24)
at javax.swing.text.PlainView.paint(PlainView.java:288)
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1422)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:722)
at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:869)
at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:848)
at javax.swing.JComponent.paintComponent(JComponent.java:752)
Caused by: javax.swing.text.BadLocationException: Length must be positive
at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:795)
at org.nlogo.editor.HighlightView.studyLine(HighlightView.java:44)
at org.nlogo.editor.HighlightView.drawLine(HighlightView.java:21)
NetLogo 5.0
```