From a493d6500c33a0956e0165ad53136fa6110a7a64 Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 29 Jul 2010 22:26:54 +0200 Subject: Fix SQL errors While trying to find out why a newly added SeriesPart won't get selected programmatically, I discovered a not so serious SQL bug. MappingTableModel::addMapping happily tries to execute queries with an invalid seriesPartId. Return if seriesPartId = -1. Now all items expanded previously will be expanded after adding a new movie. (SeriesTreeWidgetT::seriesAdded). Unfortunately the original problem remains unsolved... --- mappingtablemodel.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mappingtablemodel.cpp') diff --git a/mappingtablemodel.cpp b/mappingtablemodel.cpp index bcb601e..65221e4 100644 --- a/mappingtablemodel.cpp +++ b/mappingtablemodel.cpp @@ -163,6 +163,9 @@ bool MappingTableModel::removeItem(const QModelIndex &idx){ } bool MappingTableModel::addMapping(int seriesPartId, int itemId){ + if(seriesPartId == -1){ + return false; + } mDb.transaction(); mAddMappingQuery->bindValue(":id1", seriesPartId); mAddMappingQuery->bindValue(":id2", itemId); -- cgit v1.2.3-70-g09d2