From e0ed4d4743e255c3a381396a46b3e1c6efa93ccb Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 20 Sep 2010 16:54:12 +0000 Subject: =?UTF-8?q?=E2=80=A2=20avoid=20exceptions=20etc.=20if=20content=20?= =?UTF-8?q?filter=20clause=20is=20empty=20-=20in=20addition=20alert=20the?= =?UTF-8?q?=20user=20that=20this=20clause=20was=20empty=20to=20avoid=20con?= =?UTF-8?q?fusion=20of=20filtered=20result=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableContent.m | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'Source/SPTableContent.m') diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index e79b2c36..9a1fc14c 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -828,12 +828,20 @@ } NSDictionary *filter = [[contentFilters objectForKey:compareType] objectAtIndex:[[compareField selectedItem] tag]]; - if(![filter objectForKey:@"Clause"] || ![filter objectForKey:@"NumberOfArguments"]) { + if(![filter objectForKey:@"NumberOfArguments"]) { NSLog(@"Error while retrieving filter clause. No “Clause” or/and “NumberOfArguments” key found."); NSBeep(); return nil; } + if(![filter objectForKey:@"Clause"] || ![[filter objectForKey:@"Clause"] length]) { + + SPBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, + NSLocalizedString(@"Content Filter clause is empty.", @"content filter clause is empty tooltip.")); + + return nil; + } + NSUInteger numberOfArguments = [[filter objectForKey:@"NumberOfArguments"] integerValue]; BOOL suppressLeadingTablePlaceholder = NO; @@ -2202,16 +2210,20 @@ [item setToolTip:[filter objectForKey:@"Tooltip"]]; else { NSMutableString *tip = [[NSMutableString alloc] init]; - [tip setString:[[filter objectForKey:@"Clause"] stringByReplacingOccurrencesOfRegex:@"(?