Skip to content

Commit 05c5444

Browse files
committed
fix potential crash
1 parent e9b0a99 commit 05c5444

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/sdk/common/client/game/Options.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ namespace SDK {
1515
}
1616

1717
bool getVsync() {
18-
for (auto& option : options) {
19-
if (option->impl->id == OptionID::Vsync) {
20-
return static_cast<SDK::BoolOption*>(option.get())->value;
18+
auto it = std::find_if(options.begin(), options.end(), [](std::unique_ptr<Option>& option) {
19+
if (option && option->impl->id == OptionID::Vsync) {
20+
return true;
2121
}
22+
});
23+
24+
if (it == options.end()) {
25+
return false;
2226
}
27+
28+
return static_cast<BoolOption*>(it->get())->value;
2329
}
2430

2531
private:

0 commit comments

Comments
 (0)