summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSeif Lotfy <seif@lotfy.com>2012-10-01 01:57:40 +0200
committerSeif Lotfy <seif@lotfy.com>2012-10-01 01:57:40 +0200
commit0dddf67690ae2fa58003df8d61f56cb717cd0db9 (patch)
tree6b78250d72447910a1b89dc40f298c26225a8c33 /src
parent893510a37ca20f31fde1677172071e6cf9828e5f (diff)
downloadzeitgeist-0dddf67690ae2fa58003df8d61f56cb717cd0db9.tar.gz
Fix assert_no_wildcard
Diffstat (limited to 'src')
-rw-r--r--src/db-reader.vala22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/db-reader.vala b/src/db-reader.vala
index b27cf810..85d88723 100644
--- a/src/db-reader.vala
+++ b/src/db-reader.vala
@@ -802,20 +802,22 @@ public class DbReader : Object
* If the value starts with the negation operator, throw an
* error.
*/
- protected void assert_no_negation (string field, string val)
+ protected void assert_no_negation (string field, string? val)
throws EngineError
{
- if (!val.has_prefix ("!"))
- return;
- string error_message =
- "Field '%s' doesn't support negation".printf (field);
- warning (error_message);
- throw new EngineError.INVALID_ARGUMENT (error_message);
+ if (val != null) {
+ if (!val.has_prefix ("!"))
+ return;
+ string error_message =
+ "Field '%s' doesn't support negation".printf (field);
+ warning (error_message);
+ throw new EngineError.INVALID_ARGUMENT (error_message);
+ }
}
// Used by get_where_clause_from_event_templates
/**
- * If the value starts with the negation operator, throw an
+ * If the value starts with the expand operator, throw an
* error.
*/
protected void assert_no_noexpand (string field, string? val)
@@ -839,10 +841,10 @@ public class DbReader : Object
throws EngineError
{
if (val != null) {
- if (val.has_suffix ("*"))
+ if (!val.has_suffix ("*"))
return;
string error_message =
- "Field '%s' doesn't support prefix search".printf (field);
+ "Field '%s' doesn't support suffix search".printf (field);
warning (error_message);
throw new EngineError.INVALID_ARGUMENT (error_message);
}