File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Nodejs/Product/Nodejs/Logging Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,12 @@ internal sealed class LiveLogger {
3232 private static volatile LiveLogger _instance ;
3333 private static object _loggerLock = new object ( ) ;
3434
35- private NodejsDiagnosticsOptionsPage _diagnosticsOptions ;
35+ private NodejsDiagnosticsOptionsPage _diagnosticsOptions = null ;
3636
3737 private LiveLogger ( ) {
38- _diagnosticsOptions = NodejsPackage . Instance . DiagnosticsOptionsPage ;
38+ if ( NodejsPackage . Instance != null ) {
39+ _diagnosticsOptions = NodejsPackage . Instance . DiagnosticsOptionsPage ;
40+ }
3941 }
4042
4143 private static LiveLogger Instance {
@@ -68,7 +70,7 @@ public static void WriteLine(string format, params object[] args) {
6870 private void LogMessage ( string message ) {
6971 Debug . WriteLine ( message ) ;
7072
71- if ( _diagnosticsOptions . IsLiveDiagnosticsEnabled ) {
73+ if ( _diagnosticsOptions != null && _diagnosticsOptions . IsLiveDiagnosticsEnabled ) {
7274 var pane = OutputWindowRedirector . Get ( VisualStudio . Shell . ServiceProvider . GlobalProvider , LiveDiagnosticLogPaneGuid , LiveDiagnosticLogPaneName ) ;
7375 if ( pane != null ) {
7476 pane . WriteLine ( message ) ;
You can’t perform that action at this time.
0 commit comments