Fix application crash on startup

This commit is contained in:
Matti Viljanen 2020-03-21 04:04:03 +02:00
parent c5dbb6d6a3
commit 073defa4fc
No known key found for this signature in database
GPG key ID: CF32A1495158F888

View file

@ -39,10 +39,8 @@ Battery::Battery(Settings* newSettings, QObject* parent) : QObject(parent)
qInfo() << "Charger control feature disabled";
}
else {
chargingEnabledFile = new QFile(this);
// e.g. for Sony Xperia XA2
chargingEnabledFile->setFileName("/sys/class/power_supply/battery/input_suspend");
chargingEnabledFile = new QFile("/sys/class/power_supply/battery/input_suspend", this);
if(chargingEnabledFile->exists()) {
enableChargingValue = 0;
disableChargingValue = 1;