diff --git a/lib/headerlist.h b/lib/headerlist.h index 81c6f170..118e7c06 100644 --- a/lib/headerlist.h +++ b/lib/headerlist.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "db.h" #include "settings.h" @@ -142,9 +143,21 @@ class dbheader void fromData(QString s) { QStringList sl = s.split(" "); + if (sl.count() != 4) { + qCritical() << "Invalid header data for" << + id << name << s; + return; + } visualIndex = sl[0].toInt(); + if (visualIndex < -1) + visualIndex = -1; sortIndicator = sl[1].toInt(); + if (sortIndicator != Qt::AscendingOrder && + sortIndicator != Qt::DescendingOrder) + sortIndicator = -1; size = sl[2].toInt(); + if (size == 0) + size = -1; show = sl[3].toInt(); } void setupHeaderView(int sect, QHeaderView *hv)