[consider merging] More robust reading of session files and image strings

This commit is contained in:
Matthias Koefferlein 2025-08-16 20:01:32 +02:00
parent 5d253d3094
commit a4f3d9a33b
2 changed files with 8 additions and 1 deletions

View File

@ -1546,6 +1546,9 @@ Object::from_string (const char *str, const char *base_dir)
ex.test ("]");
} else {
// otherwise stop
break;
}
ex.test (";");

View File

@ -265,7 +265,11 @@ Session::restore (lay::MainWindow &mw)
as.reserve (vd.annotation_shapes.annotation_shapes.size ());
for (std::vector<SessionAnnotationDescriptor>::const_iterator ad = vd.annotation_shapes.annotation_shapes.begin (); ad != vd.annotation_shapes.annotation_shapes.end (); ++ad) {
db::DUserObjectBase *obj = db::DUserObjectFactory::create (ad->class_name.c_str (), ad->value_string.c_str (), ! m_base_dir.empty () ? m_base_dir.c_str () : 0);
as.insert (db::DUserObject (obj));
if (obj) {
as.insert (db::DUserObject (obj));
} else {
tl::warn << tl::to_string (tr ("Unable to restore session user object with unknown class: ")) << ad->class_name;
}
}
view->update_content ();