mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
commit
a9e76da678
@ -224,10 +224,13 @@ ScriptObjectType<Payphone> ScriptArguments::getScriptObject(
|
|||||||
unsigned int arg) const {
|
unsigned int arg) const {
|
||||||
auto& param = (*this)[arg];
|
auto& param = (*this)[arg];
|
||||||
RW_CHECK(param.isLvalue(), "Non lvalue passed as object");
|
RW_CHECK(param.isLvalue(), "Non lvalue passed as object");
|
||||||
auto index = *param.handleValue();
|
RW_CHECK(*param.handleValue() >= 0, "Object index is negative");
|
||||||
RW_CHECK(index >= 0, "Object index is negative");
|
auto index = size_t(*param.handleValue());
|
||||||
auto& payphones = getWorld()->payphones;
|
auto& payphones = getWorld()->payphones;
|
||||||
auto payphone = payphones.at(size_t(index)).get();
|
Payphone* payphone = nullptr;
|
||||||
|
if (index < payphones.size()) {
|
||||||
|
payphone = payphones[index].get();
|
||||||
|
}
|
||||||
return {param.handleValue(), payphone};
|
return {param.handleValue(), payphone};
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
|
Loading…
Reference in New Issue
Block a user