mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Don't clear tags until after loading to guard against bad XML file
This commit is contained in:
parent
82014bacd9
commit
4e6d11fe0c
18
src/Tags.cpp
18
src/Tags.cpp
@ -1245,24 +1245,26 @@ void TagsEditorDialog::OnLoad(wxCommandEvent & WXUNUSED(event))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember title and track in case they're read only
|
|
||||||
wxString title = mLocal.GetTag(TAG_TITLE);
|
|
||||||
wxString track = mLocal.GetTag(TAG_TRACK);
|
|
||||||
|
|
||||||
// Clear current contents
|
|
||||||
mLocal.Clear();
|
|
||||||
|
|
||||||
// Load the metadata
|
// Load the metadata
|
||||||
|
decltype(mLocal) temp;
|
||||||
XMLFileReader reader;
|
XMLFileReader reader;
|
||||||
if (!reader.Parse(&mLocal, fn)) {
|
if (!reader.Parse(&temp, fn)) {
|
||||||
// Inform user of load failure
|
// Inform user of load failure
|
||||||
AudacityMessageBox(
|
AudacityMessageBox(
|
||||||
reader.GetErrorStr(),
|
reader.GetErrorStr(),
|
||||||
XO("Error Loading Metadata"),
|
XO("Error Loading Metadata"),
|
||||||
wxOK | wxCENTRE,
|
wxOK | wxCENTRE,
|
||||||
this);
|
this);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remember title and track in case they're read only
|
||||||
|
wxString title = mLocal.GetTag(TAG_TITLE);
|
||||||
|
wxString track = mLocal.GetTag(TAG_TRACK);
|
||||||
|
|
||||||
|
// Replace existing tags with loaded ones
|
||||||
|
mLocal = temp;
|
||||||
|
|
||||||
// Restore title
|
// Restore title
|
||||||
if (!mEditTitle) {
|
if (!mEditTitle) {
|
||||||
mLocal.SetTag(TAG_TITLE, title);
|
mLocal.SetTag(TAG_TITLE, title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user