Skip to content

Commit

Permalink
Add some nullptr checks
Browse files Browse the repository at this point in the history
dkulp committed Oct 12, 2024
1 parent 67c0d62 commit c9399e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/OutputMonitor.cpp
Original file line number Diff line number Diff line change
@@ -101,7 +101,9 @@ class SensorCurrentMonitor : public CurrentMonitorBase {
CurrentMonitorBase(c) {
sensor = Sensors::INSTANCE.getSensorSource(c["sensor"].asString());
channel = c["channel"].asInt();
sensor->enable(channel);
if (sensor) {
sensor->enable(channel);
}
}
virtual float getRawValue() override {
if (sensor) {
@@ -475,6 +477,9 @@ void OutputMonitor::AddPortConfiguration(int port, const Json::Value& pinConfig,
std::string ep = pinConfig.get("enablePin", "").asString();
if (ep != "") {
pi->enablePin = AddOutputPin(name, ep);
if (!pi->enablePin) {
enabled = false;
}
pi->highToEnable = (ep[0] != '!');
if (!enabled) {
pi->receivers[0].enabled = false;

0 comments on commit c9399e4

Please sign in to comment.