diff options
author | hobbs <hobbs> | 2006-04-05 19:48:07 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2006-04-05 19:48:07 (GMT) |
commit | dfe85a58a2d402b797eb1433c6ac8a83d280a5c2 (patch) | |
tree | 912d2458f3cdc084e2a08af6d6ccae73ae385b22 | |
parent | 9ee6ccae287f4ea37a0a1e20c8e237c85dd4f741 (diff) | |
download | tk-dfe85a58a2d402b797eb1433c6ac8a83d280a5c2.zip tk-dfe85a58a2d402b797eb1433c6ac8a83d280a5c2.tar.gz tk-dfe85a58a2d402b797eb1433c6ac8a83d280a5c2.tar.bz2 |
* generic/tkTextDisp.c (TkTextPixelIndex): Don't segfault on full
-elide text. [Bug 1442102]
-rw-r--r-- | generic/tkTextDisp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 4866cfa..22a5a2e 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.1 2005/11/27 02:44:26 das Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.14.2.2 2006/04/05 19:48:07 hobbs Exp $ */ #include "tkPort.h" @@ -4176,6 +4176,15 @@ TkTextPixelIndex(textPtr, x, y, indexPtr) } if (dlPtr->chunkPtr == NULL) dlPtr = validdlPtr; + *indexPtr = dlPtr->index; + + /* + * If it is still empty, we have nothing to access. [Bug 1442102] + */ + + if (dlPtr->chunkPtr == NULL) { + return; + } /* * Scan through the line's chunks to find the one that contains @@ -4184,7 +4193,6 @@ TkTextPixelIndex(textPtr, x, y, indexPtr) * coordinate system of the line (to take account of x-scrolling). */ - *indexPtr = dlPtr->index; x = x - dInfoPtr->x + dInfoPtr->curPixelOffset; for (chunkPtr = dlPtr->chunkPtr; x >= (chunkPtr->x + chunkPtr->width); indexPtr->byteIndex += chunkPtr->numBytes, |