Skip to content

Commit 4ea352a

Browse files
committed
Use hasKey() instead of throwing exception.
1 parent 0d328b6 commit 4ea352a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

OpenSim/Common/DataTable.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,14 @@ class DataTable_ : public AbstractDataTable {
646646
void appendRow(const ETX& indRow, const RowVectorView& depRow) {
647647
validateRow(_indData.size(), indRow, depRow);
648648

649-
try {
649+
if (_dependentsMetaData.hasKey("labels")) {
650650
auto& labels =
651651
_dependentsMetaData.getValueArrayForKey("labels");
652652
OPENSIM_THROW_IF(static_cast<unsigned>(depRow.ncol()) !=
653653
labels.size(),
654654
IncorrectNumColumns,
655655
labels.size(),
656656
static_cast<size_t>(depRow.ncol()));
657-
} catch(KeyNotFound&) {
658-
// No "labels". So no operation.
659657
}
660658

661659
_indData.push_back(indRow);

0 commit comments

Comments
 (0)