Skip to content

Commit

Permalink
csolution crashes with config files for generated compoinents (#1521)
Browse files Browse the repository at this point in the history
csolution convert crashes when using attr=config files for generated
component and the files is missing in the gpdsc file #1442

Provide nullptr guard over rteFile
tests are pending: provided by
PR [projmgr] Expose crash when running csolution convert (#1442)

Avoid tests crash

Co-authored-by: Evgueni Driouk <[email protected]>
  • Loading branch information
grasci-arm and edriouk authored May 17, 2024
1 parent 193d344 commit addfe02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/rtemodel/src/RteProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,17 @@ void RteProject::AddCprjComponents(const Collection<RteItem*>& selItems, RteTarg

// update file versions
for (auto [instanceName, fi] : m_files) {
if(fi->IsRemoved()) {
continue;
}
string version;
auto rteFile = fi->GetFile(target->GetName());
auto itver = configFileVersions.find(instanceName); // file in cprj can be specified by its instance name
if (itver == configFileVersions.end())
itver = configFileVersions.find(fi->GetName()); // or by original name
if (itver != configFileVersions.end()) {
version = itver->second;
} else {
} else if(rteFile) {
// Fall back to the version noted in the pack
version = rteFile->GetVersionString();
}
Expand Down
1 change: 1 addition & 0 deletions libs/rtemodel/test/src/RteModelTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ TEST(RteModelTest, PackRegistryLoadPacks) {
packs1.clear();
EXPECT_TRUE(rteKernel.LoadPacks(files, packs1, &testModel, true));
EXPECT_EQ(packs1.size(), files.size());
pack1 = *packs1.begin();
EXPECT_EQ(pack1->GetFirstChild("dummy_child"), nullptr); // pack got loaded again => no added child

EXPECT_EQ(packRegistry->GetLoadedPacks().size(), files.size());
Expand Down

0 comments on commit addfe02

Please sign in to comment.