mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-20 14:47:31 +00:00
Give better error message for an invalid glyph range.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15746 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
46f18bc1ff
commit
bf56e3e54e
2 changed files with 16 additions and 2 deletions
|
@ -41,6 +41,7 @@ http://wiki.gnustep.org/index.php/NominallySpacedGlyphs
|
|||
#include "AppKit/NSLayoutManager.h"
|
||||
#include "AppKit/GSLayoutManager_internal.h"
|
||||
|
||||
#include <Foundation/NSException.h>
|
||||
#include <AppKit/NSColor.h>
|
||||
#include <AppKit/NSTextContainer.h>
|
||||
#include <AppKit/NSTextStorage.h>
|
||||
|
@ -121,16 +122,20 @@ container? necessary? */
|
|||
float x0, x1;
|
||||
NSRect r;
|
||||
|
||||
[self _doLayoutToGlyph: last - 1];
|
||||
|
||||
for (tc = textcontainers, i = 0; i < num_textcontainers; i++, tc++)
|
||||
if (tc->textContainer == container)
|
||||
break;
|
||||
[self _doLayoutToGlyph: last - 1];
|
||||
if (i == num_textcontainers ||
|
||||
tc->pos + tc->length < last ||
|
||||
tc->pos > glyphRange.location)
|
||||
{
|
||||
NSLog(@"%s: invalid text container", __PRETTY_FUNCTION__);
|
||||
if (i == num_textcontainers)
|
||||
NSLog(@"%s: invalid text container", __PRETTY_FUNCTION__);
|
||||
else
|
||||
[NSException raise: NSRangeException
|
||||
format: @"%s invalid glyph range", __PRETTY_FUNCTION__];
|
||||
*rectCount = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue