Commit dea1edbf authored by Mygod's avatar Mygod

Fix NPE yet again

parent 551bba31
......@@ -169,7 +169,8 @@ class CustomRulesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener,
inputLayout.error = message
}
override fun ret(which: Int) = if (which != DialogInterface.BUTTON_POSITIVE) null else {
override fun ret(which: Int) = when (which) {
DialogInterface.BUTTON_POSITIVE, DialogInterface.BUTTON_NEUTRAL -> {
AclEditResult(editText.text.toString().let { text ->
when (Template.values()[templateSelector.selectedItemPosition]) {
Template.Generic -> AclItem(text)
......@@ -179,6 +180,8 @@ class CustomRulesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener,
}
}, arg)
}
else -> null
}
override fun onClick(dialog: DialogInterface?, which: Int) {
if (which != DialogInterface.BUTTON_NEGATIVE) super.onClick(dialog, which)
......
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