Fix getPaymentMethodId(): check for valid iterator.
This commit is contained in:
parent
9438a535ea
commit
25a39fdc61
@ -354,22 +354,24 @@ bool Utilities::isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymen
|
||||
}
|
||||
|
||||
PaymentMethod Utilities::getPaymentMethodId(Configuration const *cfg) {
|
||||
if (cfg->PaymentOption.size() != 1) {
|
||||
if (cfg->PaymentOption.size() == 0) {
|
||||
return PaymentMethod::Undefined;
|
||||
}
|
||||
|
||||
std::multimap<int, ATBPaymentOption>::const_iterator it =
|
||||
cfg->PaymentOption.cbegin();
|
||||
|
||||
switch (it->first) {
|
||||
case PaymentMethod::Linear:
|
||||
return PaymentMethod::Linear;
|
||||
case PaymentMethod::Steps:
|
||||
return PaymentMethod::Steps;
|
||||
case PaymentMethod::Degressive:
|
||||
return PaymentMethod::Degressive;
|
||||
case PaymentMethod::Progressive:
|
||||
return PaymentMethod::Progressive;
|
||||
if (it != cfg->PaymentOption.cend()) {
|
||||
switch (it->first) {
|
||||
case PaymentMethod::Linear:
|
||||
return PaymentMethod::Linear;
|
||||
case PaymentMethod::Steps:
|
||||
return PaymentMethod::Steps;
|
||||
case PaymentMethod::Degressive:
|
||||
return PaymentMethod::Degressive;
|
||||
case PaymentMethod::Progressive:
|
||||
return PaymentMethod::Progressive;
|
||||
}
|
||||
}
|
||||
|
||||
return PaymentMethod::Undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user