mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Check for nil object before assigning struct
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13059 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0c5d456641
commit
368fa049c1
2 changed files with 23 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
Sat Mar 9 12:22:05 2002 Adam Fedor <fedor@yogi.doc.com>
|
||||
|
||||
* Source/GSSimpleLayoutManager.m:
|
||||
Check that object is not nil before asking for width (assigning
|
||||
structs from nil objects crashes Solaris). Several locations.
|
||||
|
||||
2002-03-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSScrollView.m: Go through adding checks to avoid crashes
|
||||
|
|
|
@ -373,7 +373,9 @@ static NSCharacterSet *invSelectionWordGranularitySet;
|
|||
{
|
||||
NSRect startRect = [self rectForCharacterIndex: aRange.location];
|
||||
NSRect endRect = [self rectForCharacterIndex: NSMaxRange (aRange)];
|
||||
float width = [aTextContainer containerSize].width;
|
||||
float width = 0;
|
||||
if (aTextContainer)
|
||||
width = [aTextContainer containerSize].width;
|
||||
|
||||
if (startRect.origin.y == endRect.origin.y)
|
||||
{
|
||||
|
@ -649,13 +651,16 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
// rect to the end of line
|
||||
- (NSRect) rectForCharacterIndex: (unsigned)index
|
||||
{
|
||||
float width = [[self textContainerForGlyphAtIndex: index
|
||||
effectiveRange: NULL] containerSize].width;
|
||||
float width = 0;
|
||||
id container;
|
||||
_GNULineLayoutInfo *currentInfo;
|
||||
unsigned start;
|
||||
NSRect rect;
|
||||
float x;
|
||||
|
||||
container = [self textContainerForGlyphAtIndex: index effectiveRange: NULL];
|
||||
if (container)
|
||||
width = [container containerSize].width;
|
||||
if (![_textStorage length] || ![_lineLayoutInformation count])
|
||||
{
|
||||
return NSMakeRect(0, 0, width, 12);
|
||||
|
@ -741,7 +746,9 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
_GNULineLayoutInfo *firstInfo
|
||||
= [_lineLayoutInformation objectAtIndex: redrawLineRange.location];
|
||||
NSRect displayRect = firstInfo->lineFragmentRect;
|
||||
float width = [aTextContainer containerSize].width;
|
||||
float width = 0;
|
||||
if (aTextContainer)
|
||||
width = [aTextContainer containerSize].width;
|
||||
|
||||
if (redrawLineRange.length > 1)
|
||||
displayRect = NSUnionRect(displayRect,
|
||||
|
@ -871,7 +878,9 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
|
||||
if (!length)
|
||||
{
|
||||
float width = [aTextContainer containerSize].width;
|
||||
float width = 0;
|
||||
if (aTextContainer)
|
||||
width = [aTextContainer containerSize].width;
|
||||
|
||||
// FIXME: This should be done via extra line fragment
|
||||
// If there is no text add one empty box
|
||||
|
@ -1128,7 +1137,9 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
|
|||
engine, so we do it manually. */
|
||||
if ([newlines characterIsMember: [allText characterAtIndex: (length - 1)]])
|
||||
{
|
||||
float width = [aTextContainer containerSize].width;
|
||||
float width = 0;
|
||||
if (aTextContainer)
|
||||
width = [aTextContainer containerSize].width;
|
||||
|
||||
[_lineLayoutInformation
|
||||
addObject: [_GNULineLayoutInfo
|
||||
|
|
Loading…
Reference in a new issue