Skip to content

Commit 0be9fed

Browse files
NathanielVolfangojenkins
authored andcommitted
QPR-11935 -- Make sure legInitialNotional and initialPrice are valid before using.
1 parent 02c24f5 commit 0be9fed

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

OREData/ored/portfolio/trade.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,11 @@ void Trade::setLegBasedAdditionalData(const Size i, Size resultLegId) const {
248248
additionalData_["originalNotional[" + legID + "]"] = originalNotional;
249249
if (auto eqc = boost::dynamic_pointer_cast<QuantExt::EquityCoupon>(coupon)) {
250250
Real quantity = eqc->quantity();
251-
if (quantity == Null<Real>())
252-
quantity = eqc->legInitialNotional() / eqc->initialPrice();
251+
if (quantity == Null<Real>()) {
252+
if (eqc->legInitialNotional() != Null<Real>() && eqc->initialPrice() != Null<Real>()) {
253+
quantity = eqc->legInitialNotional() / eqc->initialPrice();
254+
}
255+
}
253256
additionalData_["quantity[" + legID + "]"] = quantity;
254257
}
255258
}

0 commit comments

Comments
 (0)