Fixed submodels not displaying correctly. Fixes #922.
Some checks failed
LeoCAD CI / build-ubuntu (push) Has been cancelled
LeoCAD CI / build-macos (push) Has been cancelled

This commit is contained in:
Leonardo Zide 2024-07-16 19:15:53 -07:00
parent c4318dd8aa
commit ed53e5ffe0

View file

@ -169,9 +169,9 @@ PieceInfo* lcPiecesLibrary::FindPiece(const char* PieceName, Project* CurrentPro
PieceInfo* Info = PieceIt->second;
bool HasModel = false;
if (lcGetActiveProject())
if (CurrentProject)
{
const std::vector<std::unique_ptr<lcModel>>& Models = lcGetActiveProject()->GetModels();
const std::vector<std::unique_ptr<lcModel>>& Models = CurrentProject->GetModels();
HasModel = std::find_if(Models.begin(), Models.end(), [Model = Info->GetModel()](const std::unique_ptr<lcModel>& CheckModel) { return CheckModel.get() == Model; }) != Models.end();
}