From 359ac1cbd7eb55a995866e0c2ab36ba28ff9c8c7 Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Mon, 23 Oct 2017 08:48:44 +0200 Subject: [PATCH] Avoid crash when wellPath size = 0 --- .../WellPathCommands/RicWellPathsImportFileFeature.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp index d73ddbfb83..052003e36a 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportFileFeature.cpp @@ -68,10 +68,9 @@ void RicWellPathsImportFileFeature::onActionTriggered(bool isChecked) if (!oilField) return; - size_t lastIdx = oilField->wellPathCollection->wellPaths().size() - 1; - if (lastIdx >= 0) + if (oilField->wellPathCollection->wellPaths().size() > 0) { - RimWellPath* wellPath = oilField->wellPathCollection->wellPaths()[lastIdx]; + RimWellPath* wellPath = oilField->wellPathCollection->wellPaths()[oilField->wellPathCollection->wellPaths().size() - 1]; RiuMainWindow::instance()->selectAsCurrentItem(wellPath); } }