File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -168,38 +168,43 @@ void QgsProjectLayerGroupDialog::changeProjectFile()
168
168
return ;
169
169
}
170
170
171
+ std::unique_ptr<QgsProjectArchive> archive;
172
+
171
173
QDomDocument projectDom;
172
174
if ( QgsZipUtils::isZipFile ( mProjectFileWidget ->filePath () ) )
173
175
{
174
- QgsProjectArchive archive;
176
+
177
+ archive = qgis::make_unique<QgsProjectArchive>();
175
178
176
179
// unzip the archive
177
- if ( !archive. unzip ( mProjectFileWidget ->filePath () ) )
180
+ if ( !archive-> unzip ( mProjectFileWidget ->filePath () ) )
178
181
{
179
182
return ;
180
183
}
181
184
182
185
// test if zip provides a .qgs file
183
- if ( archive. projectFile ().isEmpty () )
186
+ if ( archive-> projectFile ().isEmpty () )
184
187
{
185
188
return ;
186
189
}
187
190
188
- projectFile.setFileName ( archive. projectFile () );
191
+ projectFile.setFileName ( archive-> projectFile () );
189
192
if ( !projectFile.exists () )
190
193
{
191
194
return ;
192
195
}
193
196
}
194
-
195
- if ( !projectDom.setContent ( &projectFile ) )
197
+ QString errorMessage;
198
+ int errorLine;
199
+ if ( !projectDom.setContent ( &projectFile, &errorMessage, &errorLine ) )
196
200
{
201
+ QgsDebugMsg ( QStringLiteral ( " Error reading the project file %1 at line %2: %3" )
202
+ .arg ( projectFile.fileName () )
203
+ .arg ( errorLine )
204
+ .arg ( errorMessage ) );
197
205
return ;
198
206
}
199
207
200
-
201
-
202
-
203
208
mRootGroup ->removeAllChildren ();
204
209
205
210
QDomElement layerTreeElem = projectDom.documentElement ().firstChildElement ( QStringLiteral ( " layer-tree-group" ) );
You can’t perform that action at this time.
0 commit comments