summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorericm <ericm>2000-07-19 18:13:50 (GMT)
committerericm <ericm>2000-07-19 18:13:50 (GMT)
commite7cd40cc0f0f5789c010b121b8dc0c9b7f80e54f (patch)
tree3f7b1efd707a71f1ecd8cba6f1118b095e88fdcd /generic
parent2dce3fbb07574fe912dfdc63a2bc0db760ec3435 (diff)
downloadtk-e7cd40cc0f0f5789c010b121b8dc0c9b7f80e54f.zip
tk-e7cd40cc0f0f5789c010b121b8dc0c9b7f80e54f.tar.gz
tk-e7cd40cc0f0f5789c010b121b8dc0c9b7f80e54f.tar.bz2
* generic/tkText.c (TextSearchCmd): Added a test for a NULL
segment pointer when doing backwards searches for "" on an empty text widget. [Bug: 6007].
Diffstat (limited to 'generic')
-rw-r--r--generic/tkText.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index d92363b..f4ebda7 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.14 2000/02/03 17:29:57 ericm Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.15 2000/07/19 18:13:50 ericm Exp $
*/
#include "default.h"
@@ -1955,10 +1955,14 @@ TextSearchCmd(textPtr, interp, argc, argv)
* account for embedded windows or any other non-textual info.
* Scan through the line's segments again to adjust both
* matchChar and matchCount.
+ *
+ * We will walk through the segments of this line until we have
+ * either reached the end of the match or we have reached the end
+ * of the line.
*/
for (segPtr = linePtr->segPtr, leftToScan = matchByte;
- leftToScan >= 0; segPtr = segPtr->nextPtr) {
+ leftToScan >= 0 && segPtr; segPtr = segPtr->nextPtr) {
if (segPtr->typePtr != &tkTextCharType) {
matchByte += segPtr->size;
continue;