From 7d51e97712f98d0dc60a8056ef6d3a8a80821117 Mon Sep 17 00:00:00 2001 From: rmottola Date: Fri, 20 May 2016 06:42:28 +0000 Subject: [PATCH] Optimize case for nil label and thus fix crasher on SPARCs git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39795 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSTabViewItem.m | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc7ed043e..c9166aa3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-20 Riccardo Mottola + + * Source/NSTabViewItem.m + Optimize case for nil label and thus fix crasher on SPARCs + 2016-05-13 Eric Heintzmann * Tests/GNUmakefile: diff --git a/Source/NSTabViewItem.m b/Source/NSTabViewItem.m index 87abe70dd..325665d58 100644 --- a/Source/NSTabViewItem.m +++ b/Source/NSTabViewItem.m @@ -1,6 +1,6 @@ /** NSTabViewItem - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. Author: Michael Hanni Date: 1999 @@ -98,12 +98,17 @@ - (NSSize) sizeOfLabel: (BOOL)shouldTruncateLabel { - NSDictionary * attr = [[NSDictionary alloc] initWithObjectsAndKeys: - [_tabview font], NSFontAttributeName, - nil]; + NSDictionary * attr; NSString *string; NSSize rSize; + if (nil == _label) + return NSZeroSize; + + attr = [[NSDictionary alloc] initWithObjectsAndKeys: + [_tabview font], NSFontAttributeName, + nil]; + if (shouldTruncateLabel) { string = [self _truncatedLabel]; @@ -178,6 +183,9 @@ NSDictionary *attr; NSString *string; + if (nil == _label) + return; + _rect = tabRect; if (shouldTruncateLabel)