| | // paragraph, instead. |
| | if( text.isBlank() ) { |
| | - paraId++; |
| | + final var paragraphs = editor.getParagraphs().size(); |
| | + |
| | + paraId = Math.min( paraId + 1, paragraphs - 1 ); |
| | paragraph = editor.getParagraph( paraId ); |
| | text = paragraph.getText(); |
 |
| | * @param editor The document (or portions thereof) to spellcheck. |
| | * @param text Look up words for this text in the lexicon. |
| | - * @param paraId Set to -1 to apply resulting style spans to the entire |
| | - * text. |
| | + * @param paraId Set to -1 to apply resulting style spans to the entire text. |
| | */ |
| | private void spellcheck( |