- if (str.length() > 1 && str.at (str.size () - 1) == '}'){
- std::string subquery_str = str.substr(1,str.size () - 2);
- notmuch_query_t *subquery = notmuch_query_create (notmuch, subquery_str.c_str());
+ if (str.size () <= 1 || str.at (str.size () - 1) != '}') {
+ throw Xapian::QueryParserError ("missing } in '" + str + "'");
+ } else {
+ std::string subquery_str = str.substr (1, str.size () - 2);
+ notmuch_query_t *subquery = notmuch_query_create (notmuch, subquery_str.c_str ());