Skip to content

Commit

Permalink
Merge pull request #301 from dpaulat/hotfix/layer_model_mime_data
Browse files Browse the repository at this point in the history
Validate parent row before dropping mime data in LayerModel
  • Loading branch information
dpaulat authored Nov 26, 2024
2 parents 4a66715 + 756249c commit 694d322
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scwx-qt/source/scwx/qt/model/layer_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,13 @@ bool LayerModel::dropMimeData(const QMimeData* data,
QDataStream stream(&mimeData, QIODevice::ReadOnly);
std::vector<int> sourceRows {};

// Validate parent row
if (parent.row() < 0 || parent.row() >= static_cast<int>(p->layers_.size()))
{
logger_->warn("Cannot perform drop action, invalid parent row");
return false;
}

// Read source rows from QMimeData
while (!stream.atEnd())
{
Expand Down

0 comments on commit 694d322

Please sign in to comment.