~aleteoryx/muditaos

2b8c60d6337b8b344b89ece9a5252424386146db — Lefucjusz 3 years ago f5a2789
[MOS-514] Fix crash on entering PIN settings

Fix of the issue that entering 'PIN settings'
window before SIM card was ready caused
the crash of the system.
1 files changed, 7 insertions(+), 2 deletions(-)

M module-services/service-cellular/src/SimCard.cpp
M module-services/service-cellular/src/SimCard.cpp => module-services/service-cellular/src/SimCard.cpp +7 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "SimCard.hpp"


@@ 43,7 43,7 @@ namespace cellular
    {
        bool SimCard::ready() const
        {
            return channel;
            return channel != nullptr;
        }

        bool SimCard::initialized() const


@@ 322,6 322,11 @@ namespace cellular

        std::optional<at::SimInsertedStatus> SimCard::readSimCardInsertStatus()
        {
            if (not ready()) {
                LOG_ERROR("SIM not ready yet.");
                return std::nullopt;
            }

            auto command  = at::cmd::QSIMSTAT(at::cmd::Modifier::Get);
            auto response = channel->cmd(command);
            auto result   = command.parseQSIMSTAT(response);