prevent npe in keyword searches

This commit is contained in:
Zlatin Balevsky
2019-06-07 06:14:40 +01:00
parent 80f2cc5f99
commit 4a9e6d3b6b

View File

@@ -157,8 +157,11 @@ abstract class Connection implements Closeable {
protected void handleSearch(def search) { protected void handleSearch(def search) {
UUID uuid = UUID.fromString(search.uuid) UUID uuid = UUID.fromString(search.uuid)
if (search.infohash != null) byte [] infohash = null
if (search.infohash != null) {
search.keywords = null search.keywords = null
infohash = Base64.decode(search.infohash)
}
Destination replyTo = new Destination(search.replyTo) Destination replyTo = new Destination(search.replyTo)
TrustLevel trustLevel = trustService.getLevel(replyTo) TrustLevel trustLevel = trustService.getLevel(replyTo)
@@ -182,7 +185,7 @@ abstract class Connection implements Closeable {
SearchEvent searchEvent = new SearchEvent(searchTerms : search.keywords, SearchEvent searchEvent = new SearchEvent(searchTerms : search.keywords,
searchHash : Base64.decode(search.infohash), searchHash : infohash,
uuid : uuid) uuid : uuid)
QueryEvent event = new QueryEvent ( searchEvent : searchEvent, QueryEvent event = new QueryEvent ( searchEvent : searchEvent,
replyTo : replyTo, replyTo : replyTo,