Skip to content

Commit

Permalink
added missing return and default case to Button::addListener
Browse files Browse the repository at this point in the history
  • Loading branch information
ion098 committed May 27, 2024
1 parent 9ad720f commit f4d01f3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gamepad/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ uint32_t Button::onRelease(std::function<void(void)> func) const {

uint32_t Button::addListener(EventType event, std::function<void(void)> func) const {
switch (event) {
case Gamepad::EventType::ON_PRESS: this->onPress(std::move(func));
case Gamepad::EventType::ON_LONG_PRESS: this->onLongPress(std::move(func));
case Gamepad::EventType::ON_RELEASE: this->onRelease(std::move(func));
case Gamepad::EventType::ON_PRESS: return this->onPress(std::move(func));
case Gamepad::EventType::ON_LONG_PRESS: return this->onLongPress(std::move(func));
case Gamepad::EventType::ON_RELEASE: return this->onRelease(std::move(func));
default:
TODO("add error logging")
errno = EINVAL;
return 0;
}
}

Expand Down

0 comments on commit f4d01f3

Please sign in to comment.