Skip to content

Commit

Permalink
LEDDisplay: fix crash when trying to obtain overlay on uninitialized …
Browse files Browse the repository at this point in the history
…canvas or display (i.e. starting with blank configs)
  • Loading branch information
vortigont committed Feb 29, 2024
1 parent 9974679 commit dbf39f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ bool LEDDisplay::_start_hub75(const DynamicJsonDocument& doc){
std::shared_ptr< LedFB<CRGB> > LEDDisplay::getOverlay(){
auto instance = _ovr.lock();

// if engine or canvas does not exist (yet) just return empty obj here
if (!_dengine || !_canvas)
return instance;

if (!instance){
// no overlay exist at the moment, let's create one
instance = std::make_shared< LedFB<CRGB> >(LedFB<CRGB>(tiles.canvas_w(), tiles.canvas_h(), _dengine->getOverlay()));
Expand Down

0 comments on commit dbf39f3

Please sign in to comment.