From 73ab348bb09e93d227ff72d7cd4082f17aa2906f Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Tue, 10 Mar 2015 15:36:31 -0400
Subject: [PATCH] account: Prevent possible off by one array access

Refs #68200
---
 src/accountstatusmodel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/accountstatusmodel.cpp b/src/accountstatusmodel.cpp
index 2f71f0c7..db91f0c4 100644
--- a/src/accountstatusmodel.cpp
+++ b/src/accountstatusmodel.cpp
@@ -430,7 +430,7 @@ void AccountStatusModel::addSipRegistrationEvent(const QString& fallbackMessage,
 
 void AccountStatusModel::addTransportEvent(const QString& fallbackMessage, int errorCode)
 {
-   if (errorCode != d_ptr->m_pAccount->lastTransportErrorCode()) {
+   if (!d_ptr->m_lRows.size() || errorCode != d_ptr->m_pAccount->lastTransportErrorCode()) {
       beginInsertRows(QModelIndex(), d_ptr->m_lRows.size(), d_ptr->m_lRows.size());
       d_ptr->m_lRows << new AccountStatusRow(fallbackMessage, errorCode, Type::TRANSPORT);
       endInsertRows();
-- 
GitLab