diff options
author | hobbs <hobbs@noemail.net> | 2006-04-05 19:48:07 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2006-04-05 19:48:07 (GMT) |
commit | 725b30850ec02f009012b1eaab6e860283d2d332 (patch) | |
tree | 912d2458f3cdc084e2a08af6d6ccae73ae385b22 /generic/tkTextDisp.c | |
parent | 3745cc908f7f8c43cb2a6bac37bf6cd60190d188 (diff) | |
download | tk-725b30850ec02f009012b1eaab6e860283d2d332.zip tk-725b30850ec02f009012b1eaab6e860283d2d332.tar.gz tk-725b30850ec02f009012b1eaab6e860283d2d332.tar.bz2 |
* generic/tkTextDisp.c (TkTextPixelIndex): Don't segfault on full
-elide text. [Bug 1442102]
FossilOrigin-Name: 77f37af36bd789f0e78c61ab1cfa07ef70c1b0bd
Diffstat (limited to 'generic/tkTextDisp.c')
-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, |