Skip to content

Commit

Permalink
Fix alternateContents in NSButtonCell (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
williameveretteggplant authored Oct 17, 2024
1 parent 55ef9f4 commit 9901bbc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Source/NSButtonCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,19 @@ - (id) initWithCoder: (NSCoder*)aDecoder
}
if ([aDecoder containsValueForKey: @"NSAlternateContents"])
{
[self setAlternateTitle: [aDecoder decodeObjectForKey: @"NSAlternateContents"]];
id alternateContents = [aDecoder decodeObjectForKey: @"NSAlternateContents"];
if ([alternateContents isKindOfClass:[NSString class]])
{
[self setAlternateTitle:alternateContents];
}
else if ([alternateContents isKindOfClass:[NSImage class]])
{
[self setAlternateImage:alternateContents];
}
else
{
NSLog(@"Invalid class for NSAlternateContents: %@", [alternateContents class]);
}
}
if ([aDecoder containsValueForKey: @"NSButtonFlags"])
{
Expand Down

0 comments on commit 9901bbc

Please sign in to comment.