Author: mlytwyn
Date: Thu Dec 4 21:11:20 2014
New Revision: 38233
URL: http://svn.gna.org/viewcvs/gnustep?rev=38233&view=rev
Log:
Fix possible NSAttributedString return from data source objectValue invocation
Modified:
libs/gui/branches/gnustep_testplant_branch/Source/NSComboBoxCell.m
Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSComboBoxCell.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSComboBoxCell.m?rev=38233&r1=38232&r2=38233&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSComboBoxCell.m
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSComboBoxCell.m Thu Dec
4 21:11:20 2014
@@ -1775,25 +1775,37 @@
}
else
{
+ id object = nil;
+
if (_dataSource == nil)
{
- NSLog(@"%@: No data source currently specified", self);
- return nil;
- }
- else if ([_dataSource respondsToSelector:
- @selector(comboBox:objectValueForItemAtIndex:)])
- {
- return [[_dataSource comboBox: (NSComboBox *)[self controlView]
- objectValueForItemAtIndex: index] description];
- }
- else if ([_dataSource respondsToSelector:
-
@selector(comboBoxCell:objectValueForItemAtIndex:)])
- {
- return [[_dataSource comboBoxCell: self
- objectValueForItemAtIndex: index] description];
- }
- }
-
+ NSLog(@"%@: No data source currently specified", self);
+ }
+ else if ([_dataSource respondsToSelector:
+ @selector(comboBox:objectValueForItemAtIndex:)])
+ {
+ object = [_dataSource comboBox: (NSComboBox *)[self controlView]
+ objectValueForItemAtIndex: index];
+ }
+ else if ([_dataSource respondsToSelector:
+ @selector(comboBoxCell:objectValueForItemAtIndex:)])
+ {
+ object = [_dataSource comboBoxCell: self objectValueForItemAtIndex:
index];
+ }
+
+ if (object)
+ {
+ // Check for attrubted string type and return actual string instead..
+ if ([object isKindOfClass :[NSAttributedString class]])
+ object = [object string];
+ else
+ object = [object description];
+
+ // Return the request object...
+ return(object);
+ }
+ }
+
return nil;
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs