@@ -114,9 +114,14 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
114114 " ClearFlash" , " PerformFirmwareUpdate" , " Nack" , " Reference" , " Generator" , " SpectrumAnalyzerSettings" ,
115115 " SpectrumAnalyzerResult" , " RequestDeviceInfo" , " RequestSourceCal" , " RequestReceiverCal" , " SourceCalPoint" ,
116116 " ReceiverCalPoint" , " SetIdle" , " RequestFrequencyCorrection" , " FrequencyCorrection" , " RequestDeviceConfiguration" ,
117- " DeviceConfiguration" , " DeviceStatus" , " RequestDeviceStatus" , " VNADatapoint" , " SetTrigger" , " ClearTrigger" };
117+ " DeviceConfiguration" , " DeviceStatus" , " RequestDeviceStatus" , " VNADatapoint" , " SetTrigger" , " ClearTrigger" ,
118+ " StopStatusUpdates" , " StartStatusUpdates" , " InitiateSweep" , " PerformAction" , " ResetDeviceConfiguration" };
118119
119- item->setData (3 , Qt::DisplayRole, " Type " +QString::number ((int )e.p ->type )+" (" +packetNames[(int )e.p ->type ]+" )" );
120+ if (int (e.p ->type ) < packetNames.size ()) {
121+ item->setData (3 , Qt::DisplayRole, " Type " +QString::number ((int )e.p ->type )+" (" +packetNames[(int )e.p ->type ]+" )" );
122+ } else {
123+ item->setData (3 , Qt::DisplayRole, " Type " +QString::number ((int )e.p ->type )+" (Unknown)" );
124+ }
120125 auto addDouble = [=](QTreeWidgetItem *parent, QString name, double value, QString unit = " " , int precision = 8 ) {
121126 auto subitem = new QTreeWidgetItem;
122127 subitem->setData (2 , Qt::DisplayRole, name);
@@ -138,7 +143,11 @@ void DevicePacketLogView::addEntry(const DevicePacketLog::LogEntry &e)
138143 auto addEnum = [=](QTreeWidgetItem *parent, QString name, int value, QStringList names) {
139144 auto subitem = new QTreeWidgetItem;
140145 subitem->setData (2 , Qt::DisplayRole, name);
141- subitem->setData (3 , Qt::DisplayRole, names[value]);
146+ if (value < names.size ()) {
147+ subitem->setData (3 , Qt::DisplayRole, names[value]);
148+ } else {
149+ subitem->setData (3 , Qt::DisplayRole, " Invalid setting (value=" +QString::number (value)+" )" );
150+ }
142151 parent->addChild (subitem);
143152 };
144153 auto addString = [=](QTreeWidgetItem *parent, QString name, QString value) {
0 commit comments