Prevent 'query' event from being emitted if there's no query object.