From 72f36803fcaee367c6614a6e66d1d2202870e093 Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Tue, 16 Jul 2024 21:40:00 +0200 Subject: [PATCH] + asserts --- GUI/View/Job/JobMessagesDisplay.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/GUI/View/Job/JobMessagesDisplay.cpp b/GUI/View/Job/JobMessagesDisplay.cpp index 2945d410dca..30aaa26fcbc 100644 --- a/GUI/View/Job/JobMessagesDisplay.cpp +++ b/GUI/View/Job/JobMessagesDisplay.cpp @@ -50,12 +50,14 @@ void JobMessagesDisplay::setJobItem(JobItem* jobItem) const bool ok = isFailed(m_job_item->batchInfo()->status()); m_comments_editor->setTextColor(ok ? Qt::black : Qt::red); connect(m_job_item->batchInfo(), &BatchInfo::jobCommentsChanged, [this](const QString&) { - if (m_job_item - && m_job_item->batchInfo()->comments() != m_comments_editor->toPlainText()) { - m_comments_editor->blockSignals(true); - m_comments_editor->setPlainText(m_job_item->batchInfo()->comments()); - m_comments_editor->blockSignals(false); - } + if (!m_job_item) + return; + ASSERT(m_job_item->batchInfo()); + if (m_job_item->batchInfo()->comments() == m_comments_editor->toPlainText()) + return; + m_comments_editor->blockSignals(true); + m_comments_editor->setPlainText(m_job_item->batchInfo()->comments()); + m_comments_editor->blockSignals(false); }); } else m_comments_editor->clear(); @@ -65,6 +67,7 @@ void JobMessagesDisplay::onCommentsEdited() { if (m_job_item) { m_job_item->blockSignals(true); + ASSERT(m_job_item->batchInfo()); m_job_item->batchInfo()->setComments(m_comments_editor->toPlainText()); m_job_item->blockSignals(false); } -- GitLab