Skip to content

Commit 1dc9e11

Browse files
roccobluesbcoconni
authored andcommitted
Fix bounds checks in FGFCS (#1191)
1 parent bb4cd5b commit 1dc9e11

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/models/FGFCS.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void FGFCS::SetDspPos( int form , double pos )
319319

320320
void FGFCS::SetThrottleCmd(int engineNum, double setting)
321321
{
322-
if (engineNum < (int)ThrottlePos.size()) {
322+
if (engineNum < (int)ThrottleCmd.size()) {
323323
if (engineNum < 0) {
324324
for (unsigned int ctr=0; ctr<ThrottleCmd.size(); ctr++)
325325
ThrottleCmd[ctr] = setting;
@@ -357,7 +357,7 @@ void FGFCS::SetThrottlePos(int engineNum, double setting)
357357

358358
double FGFCS::GetThrottleCmd(int engineNum) const
359359
{
360-
if (engineNum < (int)ThrottlePos.size()) {
360+
if (engineNum < (int)ThrottleCmd.size()) {
361361
if (engineNum < 0) {
362362
FGLogging log(FDMExec->GetLogger(), LogLevel::ERROR);
363363
log << "Cannot get throttle value for ALL engines" << endl;
@@ -397,7 +397,7 @@ double FGFCS::GetThrottlePos(int engineNum) const
397397

398398
void FGFCS::SetMixtureCmd(int engineNum, double setting)
399399
{
400-
if (engineNum < (int)ThrottlePos.size()) {
400+
if (engineNum < (int)MixtureCmd.size()) {
401401
if (engineNum < 0) {
402402
for (unsigned int ctr=0; ctr<MixtureCmd.size(); ctr++)
403403
MixtureCmd[ctr] = setting;
@@ -411,7 +411,7 @@ void FGFCS::SetMixtureCmd(int engineNum, double setting)
411411

412412
void FGFCS::SetMixturePos(int engineNum, double setting)
413413
{
414-
if (engineNum < (int)ThrottlePos.size()) {
414+
if (engineNum < (int)MixturePos.size()) {
415415
if (engineNum < 0) {
416416
for (unsigned int ctr=0; ctr<MixtureCmd.size(); ctr++)
417417
MixturePos[ctr] = MixtureCmd[ctr];
@@ -425,7 +425,7 @@ void FGFCS::SetMixturePos(int engineNum, double setting)
425425

426426
void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
427427
{
428-
if (engineNum < (int)ThrottlePos.size()) {
428+
if (engineNum < (int)PropAdvanceCmd.size()) {
429429
if (engineNum < 0) {
430430
for (unsigned int ctr=0; ctr<PropAdvanceCmd.size(); ctr++)
431431
PropAdvanceCmd[ctr] = setting;
@@ -439,7 +439,7 @@ void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
439439

440440
void FGFCS::SetPropAdvance(int engineNum, double setting)
441441
{
442-
if (engineNum < (int)ThrottlePos.size()) {
442+
if (engineNum < (int)PropAdvance.size()) {
443443
if (engineNum < 0) {
444444
for (unsigned int ctr=0; ctr<PropAdvanceCmd.size(); ctr++)
445445
PropAdvance[ctr] = PropAdvanceCmd[ctr];
@@ -453,7 +453,7 @@ void FGFCS::SetPropAdvance(int engineNum, double setting)
453453

454454
void FGFCS::SetFeatherCmd(int engineNum, bool setting)
455455
{
456-
if (engineNum < (int)ThrottlePos.size()) {
456+
if (engineNum < (int)PropFeatherCmd.size()) {
457457
if (engineNum < 0) {
458458
for (unsigned int ctr=0; ctr<PropFeatherCmd.size(); ctr++)
459459
PropFeatherCmd[ctr] = setting;
@@ -467,7 +467,7 @@ void FGFCS::SetFeatherCmd(int engineNum, bool setting)
467467

468468
void FGFCS::SetPropFeather(int engineNum, bool setting)
469469
{
470-
if (engineNum < (int)ThrottlePos.size()) {
470+
if (engineNum < (int)PropFeather.size()) {
471471
if (engineNum < 0) {
472472
for (unsigned int ctr=0; ctr<PropFeatherCmd.size(); ctr++)
473473
PropFeather[ctr] = PropFeatherCmd[ctr];

0 commit comments

Comments
 (0)