Skip to content

Commit

Permalink
Refactor: Preventing runtime.channel() from throwing exceptions on mi…
Browse files Browse the repository at this point in the history
…ssing implementations (#1074)
  • Loading branch information
tangcent authored Nov 19, 2023
1 parent 6dd8eca commit 4af278b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.itangcent.annotation.script.ScriptTypeName
import com.itangcent.common.text.TemplateEvaluator
import com.itangcent.common.text.TemplateUtils
import com.itangcent.common.text.union
import com.itangcent.common.utils.safe
import com.itangcent.idea.plugin.api.export.ExportChannel
import com.itangcent.idea.plugin.utils.LocalStorage
import com.itangcent.idea.plugin.utils.RegexUtils
Expand Down Expand Up @@ -270,7 +271,9 @@ abstract class StandardJdkRuleParser : ScriptRuleParser() {
private val actionContext by lazy { ActionContext.getContext() }

fun channel(): String? {
return actionContext?.instance(ExportChannel::class)?.channel()
return safe {
actionContext?.instance(ExportChannel::class)?.channel()
}
}

fun projectName(): String? {
Expand Down

0 comments on commit 4af278b

Please sign in to comment.