Skip to content

Commit

Permalink
[addons][language] fix crash if selected language addon no more present
Browse files Browse the repository at this point in the history
Previously, if the language addon was deleted for any reason, Kodi crashed on startup.

This adds a check that the add-on is actually there.

Here the backtrace about crash before:
```
\#0  CLangInfo::SetLanguage (this=0x55555ad37eb0, language="resource.language.de_de", reloadServices=false) at /home/alwin/Development/Kodi/kodi-Matrix/xbmc/LangInfo.cpp:670
\#1  0x0000555557ad51eb in CApplication::LoadLanguage (this=0x55555ad34c20, reload=false) at /home/alwin/Development/Kodi/kodi-Matrix/xbmc/Application.cpp:4915
\#2  0x0000555557abdbd0 in CApplication::Initialize (this=0x55555ad34c20) at /home/alwin/Development/Kodi/kodi-Matrix/xbmc/Application.cpp:737
\#3  0x0000555557635500 in XBMC_Run (renderGUI=true, params=...) at /home/alwin/Development/Kodi/kodi-Matrix/xbmc/platform/xbmc.cpp:46
\#4  0x0000555556e0b08c in main (argc=1, argv=0x7fffffffdf38) at /home/alwin/Development/Kodi/kodi-Matrix/xbmc/platform/posix/main.cpp:77
```
  • Loading branch information
AlwinEsch committed Sep 15, 2020
1 parent e8d7e6e commit 147586a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xbmc/LangInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ bool CLangInfo::SetLanguage(std::string language /* = "" */, bool reloadServices
// Find the chosen language add-on if it's enabled
if (!addonMgr.GetAddon(language, addon, ADDON::ADDON_RESOURCE_LANGUAGE, true))
{
if (addonMgr.IsAddonDisabled(addon->ID()) && !addonMgr.EnableAddon(addon->ID()))
if (!addonMgr.IsAddonInstalled(language) ||
(addonMgr.IsAddonDisabled(addon->ID()) && !addonMgr.EnableAddon(addon->ID())))
{
CLog::Log(LOGWARNING,
"CLangInfo::{}: could not find or enable language add-on '{}', loading default...",
Expand Down

0 comments on commit 147586a

Please sign in to comment.