Skip to content

Commit

Permalink
Fix "JS ERROR: TypeError: proxy is undefined"
Browse files Browse the repository at this point in the history
In cases where proxy was not checked to be defined, proxy.Brightness
was being accessed, causing a "proxy is undefined" error in some cases.
  • Loading branch information
jkitching committed Apr 19, 2024
1 parent b80e6cf commit 6cbe412
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,9 @@ export default class SoftBrightnessExtension extends Extension {
return 0;
}

const proxyBrightness = proxy.Brightness;
if (this._settings.get_boolean('use-backlight') && proxyBrightness >= 0) {
const convertedBrightness = proxyBrightness / 100.0;
this._logger.log_debug('_getBrightnessLevel() by proxy = ' + convertedBrightness + ' <- ' + proxyBrightness);
if (this._settings.get_boolean('use-backlight') && proxy.Brightness >= 0) {
const convertedBrightness = proxy.Brightness / 100.0;
this._logger.log_debug('_getBrightnessLevel() by proxy = ' + convertedBrightness + ' <- ' + proxy.Brightness);
return convertedBrightness;
} else {
const brightness = this._settings.get_double('current-brightness');
Expand Down

0 comments on commit 6cbe412

Please sign in to comment.