From 8df6715e2414b57ac05ffe7e5f4d8cbdb366dcec Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 28 Oct 2019 23:00:03 +0000 Subject: [PATCH] guard mesh.json as well --- core/src/main/groovy/com/muwire/core/mesh/MeshManager.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/groovy/com/muwire/core/mesh/MeshManager.groovy b/core/src/main/groovy/com/muwire/core/mesh/MeshManager.groovy index 607e6a39..5059fce7 100644 --- a/core/src/main/groovy/com/muwire/core/mesh/MeshManager.groovy +++ b/core/src/main/groovy/com/muwire/core/mesh/MeshManager.groovy @@ -82,6 +82,9 @@ class MeshManager { JsonSlurper slurper = new JsonSlurper() meshFile.eachLine { def json = slurper.parseText(it) + if (json.nPieces == null || json.nPieces == 0) + return // skip it, invalid + if (now - json.timestamp > settings.meshExpiration * 60 * 1000) return InfoHash infoHash = new InfoHash(Base64.decode(json.infoHash))