1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 01:05:10 +03:00

Resolve issue 8347 by checking if the for nullptr. Additionally resolve a couple other similar issues for keyboard accellerators

This commit is contained in:
ruddy douglass 2021-03-08 16:42:34 -05:00
parent f4866c822a
commit 4660dd852f
2 changed files with 14 additions and 3 deletions

View file

@ -351,6 +351,8 @@ void InputsPanel::expoOpen(QListWidgetItem *item)
if (!item)
item = ExposlistWidget->currentItem();
if (item == nullptr) return;
int idx = item->data(Qt::UserRole).toByteArray().at(0);
if (idx < 0) {
int ch = -idx - 1;
@ -368,7 +370,10 @@ void InputsPanel::expoOpen(QListWidgetItem *item)
void InputsPanel::expoAdd()
{
int index = ExposlistWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
QListWidgetItem *item = ExposlistWidget->currentItem();
if (item == nullptr) return;
int index = item->data(Qt::UserRole).toByteArray().at(0);
if (index < 0) { // if empty then return relevant index
expoOpen();

View file

@ -354,7 +354,10 @@ void MixesPanel::mixersDuplicate()
void MixesPanel::mixerOpen()
{
int idx = mixersListWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
QListWidgetItem *item = mixersListWidget->currentItem();
if (item == nullptr) return;
int idx = item->data(Qt::UserRole).toByteArray().at(0);
if(idx < 0) {
int i = -idx;
idx = getMixerIndex(i); //get mixer index to insert
@ -371,7 +374,10 @@ void MixesPanel::mixerOpen()
void MixesPanel::mixerHighlight()
{
int idx = mixersListWidget->currentItem()->data(Qt::UserRole).toByteArray().at(0);
QListWidgetItem *item = mixersListWidget->currentItem();
if (item == nullptr) return;
int idx = item->data(Qt::UserRole).toByteArray().at(0);
int dest;
if (idx<0) {
dest = -idx;