Commit ba7936de authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Only commit if there are parsers left

parent 92e1a3f9
......@@ -318,7 +318,9 @@ class RuleImportService : IntentService("RuleImportService") {
}
}
if(!isAborted) {
ruleCount += commitLines(parsers, true)
if (parsers.isNotEmpty()) {
ruleCount += commitLines(parsers, true)
}
source.ruleCount = ruleCount
getDatabase().hostSourceDao().update(source)
}
......@@ -328,7 +330,7 @@ class RuleImportService : IntentService("RuleImportService") {
parsers: Map<Matcher, Pair<Int, MutableList<DnsRule>>>,
forceCommit: Boolean = false
):Int {
val hosts = parsers[parsers.keys.minBy {
val hosts = parsers[parsers.keys.minByOrNull {
parsers[it]!!.first
} ?: parsers.keys.first()]!!.second
return if (hosts.size > ruleCommitSize || forceCommit) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment