Skip to content

Commit

Permalink
Merge pull request #383 from nextcloud/do-not-use-optional-chaining-o…
Browse files Browse the repository at this point in the history
…n-a-potentially-undeclared-root-object

Do not use optional chaining on a potentially undeclared root object
  • Loading branch information
PVince81 authored Aug 22, 2022
2 parents 1bebce3 + 04a4931 commit 8cd7b9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/LoggerBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export class LoggerBuilder {
this.context = {}
this.factory = factory
// Up to, including, nextcloud 24 the loglevel was not exposed
this.context.level = OC?.config?.loglevel !== undefined ? OC.config.loglevel : LogLevel.Warn
this.context.level = (window.hasOwnProperty('OC') && OC?.config?.loglevel !== undefined) ? OC.config.loglevel : LogLevel.Warn
// Override loglevel if we are in debug mode
if (OC?.debug) {
if (window.hasOwnProperty('OC') && OC?.debug) {
this.context.level = LogLevel.Debug
}
}
Expand Down

0 comments on commit 8cd7b9c

Please sign in to comment.