Skip to content

Commit

Permalink
Put some checks in WriteFalconPiFile to try to catch #3762
Browse files Browse the repository at this point in the history
  • Loading branch information
keithsw1111 committed Apr 25, 2023
1 parent ba125f9 commit 124bb41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xLights/TabConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,8 @@ static void addRanges(Model* m, std::map<uint32_t, uint32_t>& ranges)

void xLightsFrame::WriteFalconPiFile(const wxString& filename, bool allowSparse)
{
static log4cpp::Category& logger_base = log4cpp::Category::getInstance(std::string("log_base"));

ConvertParameters write_params(filename, // filename
_seqData, // sequence data object
&_outputManager, // global network info
Expand All @@ -1452,9 +1454,13 @@ void xLightsFrame::WriteFalconPiFile(const wxString& filename, bool allowSparse)
int numElements = _sequenceElements.GetElementCount();
for (int i = 0; i < numElements; ++i) {
Element* element = _sequenceElements.GetElement(i);
if (element == nullptr)
logger_base.crit("Element %d returns as null.", i);
if (element->GetType() == ElementType::ELEMENT_TYPE_MODEL) {
std::string modelName = element->GetModelName();
Model* m = this->GetModel(modelName);
if (m == nullptr)
logger_base.crit("Model %s returns as null.", (const char*)modelName.c_str());
addRanges(m, ranges);
}
}
Expand Down

0 comments on commit 124bb41

Please sign in to comment.