- fix: Correctly handle project templates that have wrong unit counts.

This commit is contained in:
Roy Qu 2023-10-19 08:33:37 +08:00
parent 5bf6da785c
commit fd95b49270
4 changed files with 6 additions and 3 deletions

View File

@ -12,12 +12,12 @@ Red Panda C++ Version 2.25
- Change: Empty project template won't auto create main.c/main.cpp - Change: Empty project template won't auto create main.c/main.cpp
- enhancement: When creating project, warn user if the project folder is not empty. - enhancement: When creating project, warn user if the project folder is not empty.
- fix: Press '>' after '-' don't show completion suggestion info. - fix: Press '>' after '-' don't show completion suggestion info.
- fix: Icon position not correct under hiPDI devices. - fix: Icon position not correct under hiDPI devices and zoom factor >= 200%.
- change: Add Mesa3D for windows opengl driver to the integrated mingw-gcc for windows 32 version.
- enhancement: After compiler settings changed, run/debug current file will auto recompile. - enhancement: After compiler settings changed, run/debug current file will auto recompile.
- ehhancement: Show selected char counts in status bar. - ehhancement: Show selected char counts in status bar.
- enhancement: Differentiate /* and /** when calculate auto indents. - enhancement: Differentiate /* and /** when calculate auto indents.
- fix: crash when using ibus as the input method. - fix: crash when using ibus as the input method.
- fix: Correctly handle project templates that have wrong unit counts.
Red Panda C++ Version 2.24 Red Panda C++ Version 2.24

View File

@ -970,6 +970,8 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
for (int i=0;i<aTemplate->unitCount();i++) { for (int i=0;i<aTemplate->unitCount();i++) {
// Pick file contents // Pick file contents
PTemplateUnit templateUnit = aTemplate->unit(i); PTemplateUnit templateUnit = aTemplate->unit(i);
if (!templateUnit)
continue;
if (!templateUnit->Source.isEmpty()) { if (!templateUnit->Source.isEmpty()) {
QString target = templateUnit->Source; QString target = templateUnit->Source;
PProjectUnit unit; PProjectUnit unit;

View File

@ -37,6 +37,7 @@ PTemplateUnit ProjectTemplate::unit(int index)
if (!mIni || mVersion<=0) if (!mIni || mVersion<=0)
return PTemplateUnit(); return PTemplateUnit();
QString section = QString("Unit%1").arg(index); QString section = QString("Unit%1").arg(index);
if (mIni->GetSectionSize(toByteArray(section))<0) return PTemplateUnit();
PTemplateUnit unit = std::make_shared<TemplateUnit>(); PTemplateUnit unit = std::make_shared<TemplateUnit>();
QString lang = pSettings->environment().language(); QString lang = pSettings->environment().language();
if (!lang.isEmpty()) { if (!lang.isEmpty()) {

View File

@ -9,5 +9,5 @@ Category=Basic
Category[zh_CN]=基础 Category[zh_CN]=基础
[Project] [Project]
UnitCount=1 UnitCount=0
Type=1 Type=1