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/>."""
path = os.path.split(name)[0]
if path != self.settings.last_file_path:
self.set("last_file_path", path)
abspath = os.path.abspath(name)
recent_files = json.loads(self.settings.recentfiles)
if abspath in recent_files:
recent_files.remove(abspath)
recent_files.insert(0, abspath)
if len(recent_files) > 5:
recent_files = recent_files[:5]
self.set("recentfiles", json.dumps(recent_files))
try:
abspath = os.path.abspath(name)
recent_files = json.loads(self.settings.recentfiles)
if abspath in recent_files:
recent_files.remove(abspath)
recent_files.insert(0, abspath)
if len(recent_files) > 5:
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"):
self.skein(name)
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