summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 797c61b..5edf102 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -1173,9 +1173,10 @@ if(featureAutoSave)
1173 } 1173 }
1174} 1174}
1175 1175
1176void TextEdit::gotoLine() { 1176void TextEdit::gotoLine() {
1177 1177 if( editor->length() < 1)
1178 return;
1178 QWidget *d = QApplication::desktop(); 1179 QWidget *d = QApplication::desktop();
1179 gotoEdit = new QLineEdit( 0, "Goto line"); 1180 gotoEdit = new QLineEdit( 0, "Goto line");
1180 1181
1181 gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2)); 1182 gotoEdit->move( (d->width()/2) - ( gotoEdit->width()/2) , (d->height()/2) - (gotoEdit->height()/2));
@@ -1186,16 +1187,17 @@ void TextEdit::gotoLine() {
1186 1187
1187void TextEdit::doGoto() { 1188void TextEdit::doGoto() {
1188 QString number = gotoEdit->text(); 1189 QString number = gotoEdit->text();
1189 gotoEdit->hide(); 1190 gotoEdit->hide();
1191
1190 if(gotoEdit) { 1192 if(gotoEdit) {
1191 delete gotoEdit; 1193 delete gotoEdit;
1192 gotoEdit = 0; 1194 gotoEdit = 0;
1193 } 1195 }
1194 1196
1195 bool ok; 1197 bool ok;
1196 int lineNumber = number.toInt(&ok, 10); 1198 int lineNumber = number.toInt(&ok, 10);
1197 if(editor->numLines() < lineNumber) 1199 if( editor->numLines() < lineNumber)
1198 QMessageBox::message(tr("Text Edit"),tr("Not enough lines")); 1200 QMessageBox::message(tr("Text Edit"),tr("Not enough lines"));
1199 else 1201 else
1200 { 1202 {
1201 editor->setCursorPosition(lineNumber, 0, false); 1203 editor->setCursorPosition(lineNumber, 0, false);