mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
Fix issue with calling setState: on classes which aren't NSSwitch when it's not needed
This commit is contained in:
parent
5d1ec31ef2
commit
ab83e1ef81
1 changed files with 4 additions and 3 deletions
|
@ -53,6 +53,7 @@
|
|||
#import "AppKit/NSScrollView.h"
|
||||
#import "AppKit/NSSliderCell.h"
|
||||
#import "AppKit/NSSplitView.h"
|
||||
#import "AppKit/NSSwitch.h"
|
||||
#import "AppKit/NSTableColumn.h"
|
||||
#import "AppKit/NSTableHeaderView.h"
|
||||
#import "AppKit/NSTableView.h"
|
||||
|
@ -2792,10 +2793,10 @@ didStartElement: (NSString*)elementName
|
|||
// Handle state for NSSwitch
|
||||
if ([element attributeForKey: @"state"])
|
||||
{
|
||||
if ([object respondsToSelector: @selector(setState:)])
|
||||
if ([object respondsToSelector: @selector(setState:)] && [object isKindOfClass: [NSSwitch class]])
|
||||
{
|
||||
[object setState: [[element attributeForKey: @"state"] isEqualToString: @"on"] ?
|
||||
NSControlStateValueOn : NSControlStateValueOff];
|
||||
[(NSSwitch *)object setState: [[element attributeForKey: @"state"] isEqualToString: @"on"] ?
|
||||
NSControlStateValueOn : NSControlStateValueOff];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue