Commit 615823f7 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Try to find a source by it's ID if there reference cannot be found

parent c93f07c5
Pipeline #5853 passed with stage
in 3 minutes and 19 seconds
...@@ -235,7 +235,7 @@ class DnsRuleFragment : Fragment() { ...@@ -235,7 +235,7 @@ class DnsRuleFragment : Fragment() {
} }
getDatabase().hostSourceDao().update(currentSource) getDatabase().hostSourceDao().update(currentSource)
val index = sourceAdapterList.indexOf(hostSource) val index = sourceAdapterList.indexOf(hostSource).takeIf { it >= 0 } ?: sourceAdapterList.indexOfFirst { it.id == hostSource.id }
sourceAdapterList[index] = currentSource sourceAdapterList[index] = currentSource
sourceRuleCount[currentSource] = sourceRuleCount[hostSource] sourceRuleCount[currentSource] = sourceRuleCount[hostSource]
sourceRuleCount.remove(hostSource) sourceRuleCount.remove(hostSource)
......
Supports Markdown
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