Skip to content

Commit

Permalink
Fixed strings hot reload crashing Amethyst occasionally
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Oct 2, 2022
1 parent d4d89e8 commit 547f72e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Amethyst/K2Shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ namespace k2app::interfacing
const auto json_object = winrt::Windows::Data::Json::JsonObject::Parse(wss.str());

// Check if the resource root is fine
if (json_object.Size() <= 0)
if (!json_object || json_object.Size() <= 0)
{
LOG(ERROR) << "The current language enumeration resource root is empty!"
"App interface will be broken!";
Expand Down Expand Up @@ -416,7 +416,7 @@ namespace k2app::interfacing
m_local_resources = winrt::Windows::Data::Json::JsonObject::Parse(wss.str());

// Check if the resource root is fine
if (m_local_resources.Size() <= 0)
if (!m_local_resources || m_local_resources.Size() <= 0)
LOG(ERROR) << "The current resource root is empty! App interface will be broken!";

else
Expand Down Expand Up @@ -471,7 +471,7 @@ namespace k2app::interfacing
m_english_resources = winrt::Windows::Data::Json::JsonObject::Parse(wss.str());

// Check if the resource root is fine
if (m_english_resources.Size() <= 0)
if (!m_english_resources || m_english_resources.Size() <= 0)
LOG(ERROR) << "The current resource root is empty! App interface will be broken!";

else
Expand All @@ -495,7 +495,7 @@ namespace k2app::interfacing
try
{
// Check if the resource root is fine
if (m_local_resources.Size() <= 0)
if (!m_local_resources || m_local_resources.Size() <= 0)
{
LOG(ERROR) << "The current resource root is empty! App interface will be broken!";
return resource_key; // Just give up
Expand Down Expand Up @@ -527,7 +527,7 @@ namespace k2app::interfacing
try
{
// Check if the resource root is fine
if (m_english_resources.Size() <= 0)
if (!m_english_resources || m_english_resources.Size() <= 0)
{
LOG(ERROR) << "The current EN resource root is empty! App interface will be broken!";
return resource_key; // Just give up
Expand Down

0 comments on commit 547f72e

Please sign in to comment.