mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Check the types of defaults values before using them.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16870 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3ba0fb3924
commit
fe3da45353
2 changed files with 21 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-06-05 16:42 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/NSMenu.m: Check the types of all defaults values before
|
||||
using them.
|
||||
|
||||
2003-06-05 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* GMAppKit.m (-initWithModelUnarchiver:): #ifdef out ivar assignment
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
|
||||
|
||||
static NSZone *menuZone = NULL;
|
||||
static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
||||
static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
||||
static NSString *NSEnqueuedMenuMoveName = @"EnqueuedMoveNotificationName";
|
||||
static NSNotificationCenter *nc;
|
||||
|
||||
|
@ -213,7 +213,11 @@ static NSNotificationCenter *nc;
|
|||
NSString *locString;
|
||||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [[defaults objectForKey: NSMenuLocationsKey] mutableCopy];
|
||||
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
if ([menuLocations isKindOfClass: [NSDictionary class]])
|
||||
menuLocations = [menuLocations mutableCopy];
|
||||
else
|
||||
menuLocations = nil;
|
||||
|
||||
if ([_aWindow isVisible]
|
||||
&& ([self isTornOff] || ([NSApp mainMenu] == self)))
|
||||
|
@ -1179,8 +1183,11 @@ static NSNotificationCenter *nc;
|
|||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
|
||||
location = [menuLocations objectForKey: key];
|
||||
|
||||
if ([menuLocations isKindOfClass: [NSDictionary class]])
|
||||
location = [menuLocations objectForKey: key];
|
||||
else
|
||||
location = nil;
|
||||
if (location && [location isKindOfClass: [NSString class]])
|
||||
{
|
||||
[self setTornOff: YES];
|
||||
|
@ -1324,7 +1331,11 @@ static NSNotificationCenter *nc;
|
|||
{
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
menuLocations = [defaults objectForKey: NSMenuLocationsKey];
|
||||
location = [menuLocations objectForKey: key];
|
||||
|
||||
if ([menuLocations isKindOfClass: [NSDictionary class]])
|
||||
location = [menuLocations objectForKey: key];
|
||||
else
|
||||
location = nil;
|
||||
|
||||
if (location && [location isKindOfClass: [NSString class]])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue