Skip to content

Commit

Permalink
Fix layer model sign comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulat committed Oct 28, 2023
1 parent ba75326 commit f785148
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scwx-qt/source/scwx/qt/model/layer_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ bool LayerModel::dropMimeData(const QMimeData* data,
// Ensure rows are in numerical order
std::sort(sourceRows.begin(), sourceRows.end());

if (sourceRows.back() >= p->layers_.size())
if (sourceRows.back() >= static_cast<int>(p->layers_.size()))
{
logger_->error("Cannot perform drop action, invalid source rows");
return false;
Expand Down Expand Up @@ -907,12 +907,13 @@ bool LayerModel::moveRows(const QModelIndex& sourceParent,
{
bool moved = false;

if (sourceParent != destinationParent || // Only accept internal moves
count < 1 || // Minimum selection size of 1
sourceRow < 0 || // Valid source row (start)
sourceRow + count > p->layers_.size() || // Valid source row (end)
destinationChild < 0 || // Valid destination row
destinationChild > p->layers_.size())
if (sourceParent != destinationParent || // Only accept internal moves
count < 1 || // Minimum selection size of 1
sourceRow < 0 || // Valid source row (start)
sourceRow + count >
static_cast<int>(p->layers_.size()) || // Valid source row (end)
destinationChild < 0 || // Valid destination row
destinationChild > static_cast<int>(p->layers_.size()))
{
return false;
}
Expand Down

0 comments on commit f785148

Please sign in to comment.