From 121dd6636224380d5e5ca5286d627d9137c48312 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sun, 13 May 2018 22:08:36 -0500 Subject: [PATCH] Handle possible narrowing of data type between unsigned long and signed long --- src/GUI/Plater.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GUI/Plater.cpp b/src/GUI/Plater.cpp index 7eb51d9a8..24cce1573 100644 --- a/src/GUI/Plater.cpp +++ b/src/GUI/Plater.cpp @@ -950,7 +950,13 @@ void Plater::set_number_of_copies() { long copies = -1; copies = wxGetNumberFromUser("", _("Enter the number of copies of the selected object:"), _("Copies"), model_object->instances.size(), 0, 1000, this); if (copies < 0) return; - long diff {copies - model_object->instances.size() }; + long instance_count = 0; + if (model_object->instances.size() <= LONG_MAX) { + instance_count = static_cast(model_object->instances.size()); + } else { + instance_count = LONG_MAX; + } + long diff {copies - instance_count }; if (diff == 0) { this->resume_background_process(); } else if (diff > 0) { this->increase(diff); }