Skip to content

Commit

Permalink
fix: unsafe reference to guarded object
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr authored Jan 18, 2024
1 parent 328eb49 commit b6ab61d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sscma/interface/wifi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class WiFi final : public Supervisable, public StatefulInterface {
EL_LOGD("[SSCMA] WiFi::poll_from_supervisor()");

if (_wifi_config.is_synchorized()) [[likely]] {
const auto& config = _wifi_config.load_last();
auto current_sta = sync_status_from_driver();
auto config = _wifi_config.load_last();
auto current_sta = sync_status_from_driver();
if (current_sta < config.second.first) [[unlikely]]
bring_up(config.second);
} else {
Expand Down
2 changes: 1 addition & 1 deletion sscma/prototypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ template <typename T> class SynchronizableObject {
return *_prev;
}

const std::pair<std::size_t, T>& load_last() const {
std::pair<std::size_t, T> load_last() const {
const Guard guard(_lock);
return *_prev;
}
Expand Down

0 comments on commit b6ab61d

Please sign in to comment.