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