1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1122 OP-1123 fixed assertion errors when loading waypoint file in wp editor

This commit is contained in:
Philippe Renon 2013-11-21 00:22:19 +01:00
parent aff543561b
commit 87725ded48
2 changed files with 5 additions and 2 deletions

View File

@ -469,7 +469,7 @@ bool flightDataModel::insertRows(int row, int count, const QModelIndex & /*paren
bool flightDataModel::removeRows(int row, int count, const QModelIndex & /*parent*/)
{
if (row < 0) {
if (row < 0 || count <= 0) {
return false;
}
beginRemoveRows(QModelIndex(), row, row + count - 1);

View File

@ -345,7 +345,10 @@ void modelMapProxy::createWayPoint(internals::PointLatLng coord)
index = model->index(model->rowCount() - 1, flightDataModel::ERRORDESTINATION, QModelIndex());
model->setData(index, 1, Qt::EditRole);
}
void modelMapProxy::deleteAll()
{
model->removeRows(0, model->rowCount(), QModelIndex());
if (model->rowCount() > 0) {
model->removeRows(0, model->rowCount(), QModelIndex());
}
}