fix: prevent crash by ensuring there is active section on app start

If `activeSectionId` does point to section that is not restored
correctly (by any reason), then the app will crash. That's becasue code
assumes there is always an active section set and it will try to
reference null item in this case.

fixes: #8785
This commit is contained in:
Patryk Osmaczko 2022-12-14 14:35:00 +01:00 committed by osmaczko
parent 8a749846df
commit c9b1082795
1 changed files with 1 additions and 1 deletions

View File

@ -472,7 +472,7 @@ method load*[T](
# Set active section on app start
# If section is profile then open chat by default
if activeSection.sectionType == SectionType.ProfileSettings:
if activeSection.isEmpty() or activeSection.sectionType == SectionType.ProfileSettings:
self.setActiveSection(self.view.model().getItemBySectionType(SectionType.Chat))
else:
self.setActiveSection(activeSection)