diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPConstants.h | 3 | ||||
-rw-r--r-- | Source/SPDatabaseAction.m | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h index a2df5bde..728d213a 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -642,3 +642,6 @@ void _SPClear(id *addr); #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_10 typedef NSUInteger NSCellHitResult; #endif + +// Stolen from Stack Overflow: http://stackoverflow.com/questions/969130 +#define SPLog(fmt, ...) NSLog((@"%s:%d: " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/Source/SPDatabaseAction.m b/Source/SPDatabaseAction.m index c7f5dbf9..413e2378 100644 --- a/Source/SPDatabaseAction.m +++ b/Source/SPDatabaseAction.m @@ -65,7 +65,10 @@ - (BOOL)createDatabase:(NSString *)database withEncoding:(NSString *)encoding collation:(NSString *)collation { - NSParameterAssert(database != nil && [database length] > 0); + if(![database length]) { + SPLog(@"'database' should not be nil or empty!"); + return NO; + } NSMutableString *query = [NSMutableString stringWithFormat:@"CREATE DATABASE %@", [database backtickQuotedString]]; |