Do not call component update on failed components (#1392)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
AlexandJesse Hills authored and Jesse Hills committed 2021-05-05 22:35:17 +12:00
1 parent be70a96651
commit 37bc0b3b5a
1 file changed
+5 -1
+5 -1
View File
@@ -266,7 +266,11 @@ template<typename... Ts> class UpdateComponentAction : public Action<Ts...> {
public:
UpdateComponentAction(PollingComponent *component) : component_(component) {}
void play(Ts... x) override { this->component_->update(); }
void play(Ts... x) override {
if (this->component_->is_failed())
return;
this->component_->update();
}
protected:
PollingComponent *component_;