Skip to content

Commit cc04572

Browse files
authored
Merge branch 'praydog:master' into master
2 parents 59d9b73 + 76520ca commit cc04572

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

include/reframework/API.hpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,13 @@ class API {
529529
static const auto fn = API::s_instance->sdk()->type_definition->get_methods;
530530

531531
std::vector<API::Method*> methods;
532-
methods.resize(get_num_methods());
532+
533+
auto num_methods = get_num_methods();
534+
if (num_methods < 1) {
535+
return {};
536+
}
537+
538+
methods.resize(num_methods);
533539

534540
auto result = fn(*this, (REFrameworkMethodHandle*)&methods[0], methods.size() * sizeof(API::Method*), nullptr);
535541

@@ -544,7 +550,14 @@ class API {
544550
static const auto fn = API::s_instance->sdk()->type_definition->get_fields;
545551

546552
std::vector<API::Field*> fields;
547-
fields.resize(get_num_fields());
553+
554+
555+
auto num_fields = get_num_fields();
556+
if (num_fields < 1) {
557+
return {};
558+
}
559+
560+
fields.resize(num_fields);
548561

549562
auto result = fn(*this, (REFrameworkFieldHandle*)&fields[0], fields.size() * sizeof(API::Field*), nullptr);
550563

@@ -681,7 +694,13 @@ class API {
681694
static const auto fn = API::s_instance->sdk()->method->get_params;
682695

683696
std::vector<REFrameworkMethodParameter> params;
684-
params.resize(get_num_params());
697+
698+
auto num_params = get_num_params();
699+
if (num_params < 1) {
700+
return {};
701+
}
702+
703+
params.resize(num_params);
685704

686705
auto result = fn(*this, (REFrameworkMethodParameter*)&params[0], params.size() * sizeof(REFrameworkMethodParameter), nullptr);
687706

0 commit comments

Comments
 (0)