Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jadhavrohit924 committed Jan 22, 2024
1 parent c9ccd14 commit a508f62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ CHIP_ERROR EnergyEvseManager::LoadPersistentAttributes()
{

SafeAttributePersistenceProvider * aProvider = GetSafeAttributePersistenceProvider();
EndpointId aEndpointId = mDelegate->GetEndpointId();
if (aProvider == nullptr)
{
ChipLogError(AppServer, "GetSafeAttributePersistenceProvider returned NULL");
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}
EndpointId aEndpointId = mDelegate->GetEndpointId();
CHIP_ERROR err;

// Restore ChargingEnabledUntil value
Expand Down
14 changes: 8 additions & 6 deletions examples/energy-management-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ using namespace ::chip::Credentials;
using namespace ::chip::DeviceManager;
using namespace ::chip::DeviceLayer;

static EnergyEvseDelegate * gEvseDelegate = nullptr;
static EnergyEvseManager * gEvseInstance = nullptr;
static EVSEManufacturer * gEvseManufacturer = nullptr;
static DeviceEnergyManagementDelegate * gDEMDelegate = nullptr;
static DeviceEnergyManagementManager * gDEMInstance = nullptr;
static EnergyEvseDelegate * gEvseDelegate = nullptr;
static EnergyEvseManager * gEvseInstance = nullptr;
static EVSEManufacturer * gEvseManufacturer = nullptr;
static DeviceEnergyManagementDelegate * gDEMDelegate = nullptr;
static DeviceEnergyManagementManager * gDEMInstance = nullptr;

#if CONFIG_ENABLE_ESP_INSIGHTS_TRACE
extern const char insights_auth_key_start[] asm("_binary_insights_auth_key_txt_start");
Expand Down Expand Up @@ -181,7 +181,6 @@ void ApplicationInit()

static void InitServer(intptr_t context)
{
ApplicationInit();
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlags(CONFIG_RENDEZVOUS_MODE));

Expand All @@ -203,6 +202,9 @@ static void InitServer(intptr_t context)
static Tracing::Insights::ESP32Backend backend;
Tracing::Register(backend);
#endif

// Application code should always be initialised after the initialisation of server.
ApplicationInit();
}

extern "C" void app_main()
Expand Down

0 comments on commit a508f62

Please sign in to comment.