mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2025-02-04 04:52:19 +00:00
Fix a crash when pressing enter with no selection.
Crash when pressing ok with no plugin selected.
This commit is contained in:
parent
d246dc875f
commit
4c1ae2e2b0
1 changed files with 5 additions and 1 deletions
|
@ -165,6 +165,10 @@ void PluginsList::showInfo(QListWidgetItem *pitem, QListWidgetItem *previous)
|
||||||
|
|
||||||
void PluginsList::insert(QListWidgetItem *pitem)
|
void PluginsList::insert(QListWidgetItem *pitem)
|
||||||
{
|
{
|
||||||
|
if(!pitem) {
|
||||||
|
qDebug() << "Do not insert null item";
|
||||||
|
return;
|
||||||
|
}
|
||||||
qDebug() << "Insert: " << pitem -> text();
|
qDebug() << "Insert: " << pitem -> text();
|
||||||
|
|
||||||
if(!m_pGraph || !m_pGraph -> AddPlugin(pitem -> text().toStdString().c_str(), NULL))
|
if(!m_pGraph || !m_pGraph -> AddPlugin(pitem -> text().toStdString().c_str(), NULL))
|
||||||
|
@ -183,7 +187,7 @@ bool PluginsList::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
QKeyEvent *key = static_cast<QKeyEvent*>(event);
|
QKeyEvent *key = static_cast<QKeyEvent*>(event);
|
||||||
|
|
||||||
if((key -> key() == Qt::Key_Enter) || (key -> key() == Qt::Key_Return))
|
if((key -> key() == Qt::Key_Enter) || (key -> key() == Qt::Key_Return) && m_pPlugins -> currentItem())
|
||||||
{
|
{
|
||||||
insert(m_pPlugins -> currentItem());
|
insert(m_pPlugins -> currentItem());
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue