From ce505f6776de9f0ead11aa9f0400555fabdbd96d Mon Sep 17 00:00:00 2001 From: "Svetlana.Zemlyanskaya" Date: Mon, 25 Jun 2018 15:15:21 +0200 Subject: [PATCH] FB-125 Filter settings and dialogs: explicitly check if application exists --- .../statistic/eventLog/FeatureUsageUiEvents.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt b/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt index f08f960ee386..6f789872c497 100644 --- a/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt +++ b/platform/platform-api/src/com/intellij/internal/statistic/eventLog/FeatureUsageUiEvents.kt @@ -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 {