2
0

Fix deleting of users.

[FIXED]     When retrieving content without a key set, return nil.
This commit is contained in:
Maarten Billemont 2012-07-15 00:09:20 +02:00
parent 3e19a026ba
commit 8c71ed0081
3 changed files with 17 additions and 5 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 2a158bc768e719a6d2f11eaf9426ae7ed8b83d9c Subproject commit 396fe5bd8a53adad376231ff32c56984f94c9c96

View File

@ -7,7 +7,7 @@
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry <BuildActionEntry
buildForTesting = "NO" buildForTesting = "YES"
buildForRunning = "YES" buildForRunning = "YES"
buildForProfiling = "YES" buildForProfiling = "YES"
buildForArchiving = "YES" buildForArchiving = "YES"

View File

@ -104,6 +104,10 @@
- (id)content { - (id)content {
NSData *key = [MPAppDelegate get].key;
if (!key)
return nil;
if (!(self.type & MPElementTypeClassGenerated)) { if (!(self.type & MPElementTypeClassGenerated)) {
err(@"Corrupt element: %@, type: %d is not in MPElementTypeClassGenerated", self.name, self.type); err(@"Corrupt element: %@, type: %d is not in MPElementTypeClassGenerated", self.name, self.type);
return nil; return nil;
@ -112,7 +116,7 @@
if (![self.name length]) if (![self.name length])
return nil; return nil;
return MPCalculateContent(self.type, self.name, [MPAppDelegate get].key, self.counter); return MPCalculateContent(self.type, self.name, key, self.counter);
} }
@end @end
@ -131,12 +135,20 @@
- (id)content { - (id)content {
return [self contentUsingKey:[MPAppDelegate get].key]; NSData *key = [MPAppDelegate get].key;
if (!key)
return nil;
return [self contentUsingKey:key];
} }
- (void)setContent:(id)content { - (void)setContent:(id)content {
[self setContent:content usingKey:[MPAppDelegate get].key]; NSData *key = [MPAppDelegate get].key;
if (!key)
return;
[self setContent:content usingKey:key];
} }
- (id)contentUsingKey:(NSData *)key { - (id)contentUsingKey:(NSData *)key {