Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
f719706b
Commit
f719706b
authored
3 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
messagelistmodel: protect against crash on incorrect index
Change-Id: Icaaf1f1628a1bd0b8f3fe1992424abb4d2b60bf3
parent
88ca4fb3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/messagelistmodel.cpp
+5
-1
5 additions, 1 deletion
src/messagelistmodel.cpp
with
5 additions
and
1 deletion
src/messagelistmodel.cpp
+
5
−
1
View file @
f719706b
...
...
@@ -240,6 +240,10 @@ void
MessageListModel
::
moveMessage
(
const
QString
&
msgId
,
const
QString
&
parentId
)
{
int
currentIndex
=
indexOfMessage
(
msgId
);
if
(
currentIndex
==
-
1
)
{
qWarning
()
<<
"Incorrect index detected in MessageListModel::moveMessage"
;
return
;
}
// if we have a next element check if it is a child interaction
QString
childMessageIdToMove
;
...
...
@@ -256,7 +260,7 @@ MessageListModel::moveMessage(const QString& msgId, const QString& parentId)
newIndex
=
interactions_
.
size
()
-
1
;
}
if
(
currentIndex
==
newIndex
)
if
(
currentIndex
==
newIndex
||
newIndex
==
-
1
)
return
;
moveMessage
(
currentIndex
,
newIndex
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment