Skip to content

Commit 1f2aa3d

Browse files
authored
Merge pull request #73 from Riptide3/master
fix: assign value to uninitialized vector
2 parents 978abe1 + dd5f917 commit 1f2aa3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

casbin/enforcer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ bool Enforcer :: enforce(string matcher, Scope scope) {
7878
int policy_len = int(this->model->m["p"].assertion_map["p"]->policy.size());
7979

8080
vector <Effect> policy_effects(policy_len, Effect :: Indeterminate);
81-
vector <float> matcher_results;
81+
vector <float> matcher_results(policy_len);
8282

8383
if(policy_len != 0) {
8484
if(this->model->m["r"].assertion_map["r"]->tokens.size() != this->func_map.GetRLen())
@@ -110,8 +110,8 @@ bool Enforcer :: enforce(string matcher, Scope scope) {
110110
}
111111
}
112112
else if(CheckType(this->func_map.scope) == Type :: Float){
113-
bool result = GetFloat(this->func_map.scope);
114-
if(result == 0) {
113+
float result = GetFloat(this->func_map.scope);
114+
if(result == 0.0) {
115115
policy_effects[i] = Effect :: Indeterminate;
116116
continue;
117117
} else

0 commit comments

Comments
 (0)