Skip to content

Commit 5a0840d

Browse files
Pietfriedcorneliusclaussen
authored andcommitted
checking optional before accessing value
Signed-off-by: pietfried <pietgoempel@gmail.com>
1 parent cb86b46 commit 5a0840d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/EnergyManager/Market.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ ScheduleReq Market::get_max_available_energy(const ScheduleReq& request) {
160160
(*r).limits_to_leaves.total_power_W.value() / (*r).conversion_efficiency.value_or(1.);
161161
}
162162
// do we have a lower watt limit on root side?
163-
if ((*r).limits_to_root.total_power_W.has_value() &&
163+
if ((*r).limits_to_root.total_power_W.has_value() && a.limits_to_root.total_power_W.has_value() &&
164164
a.limits_to_root.total_power_W.value() > (*r).limits_to_root.total_power_W.value()) {
165165
a.limits_to_root.total_power_W = (*r).limits_to_root.total_power_W.value();
166166
}

0 commit comments

Comments
 (0)