Commit 05bbf376 authored by Guillaume Seguin's avatar Guillaume Seguin

Protect recent files update with a try/except

parent 2ab68240
...@@ -1576,14 +1576,18 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1576,14 +1576,18 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
path = os.path.split(name)[0] path = os.path.split(name)[0]
if path != self.settings.last_file_path: if path != self.settings.last_file_path:
self.set("last_file_path", path) self.set("last_file_path", path)
abspath = os.path.abspath(name) try:
recent_files = json.loads(self.settings.recentfiles) abspath = os.path.abspath(name)
if abspath in recent_files: recent_files = json.loads(self.settings.recentfiles)
recent_files.remove(abspath) if abspath in recent_files:
recent_files.insert(0, abspath) recent_files.remove(abspath)
if len(recent_files) > 5: recent_files.insert(0, abspath)
recent_files = recent_files[:5] if len(recent_files) > 5:
self.set("recentfiles", json.dumps(recent_files)) recent_files = recent_files[:5]
self.set("recentfiles", json.dumps(recent_files))
except:
self.logError(_("Could not update recent files list:") +
"\n" + traceback.format_exc())
if name.lower().endswith(".stl"): if name.lower().endswith(".stl"):
self.skein(name) self.skein(name)
elif name.lower().endswith(".obj"): elif name.lower().endswith(".obj"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment