FB-125 Filter settings and dialogs: explicitly check if application exists

This commit is contained in:
Svetlana.Zemlyanskaya
2018-06-25 15:17:02 +02:00
parent 727e61d18c
commit ce505f6776
@@ -1,15 +1,15 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.internal.statistic.eventLog
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ServiceManager
fun getUiEventLogger(): FeatureUsageUiEvents {
return try {
ServiceManager.getService(FeatureUsageUiEvents::class.java) ?: EmptyFeatureUsageUiEvents
}
catch (e : Exception) {
EmptyFeatureUsageUiEvents
if (ApplicationManager.getApplication() != null) {
return ServiceManager.getService(FeatureUsageUiEvents::class.java) ?: EmptyFeatureUsageUiEvents
}
// cannot load service if application is not initialized
return EmptyFeatureUsageUiEvents
}
interface FeatureUsageUiEvents {