Merge pull request #5754 from keymanapp/fix/linux/5753

fix(linux): Don't crash with non-keyboard package file
This commit is contained in:
Eberhard Beilharz 2021-10-05 09:29:28 +02:00 • committed by GitHub
commit bc308ad42d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,6 +62,15 @@ class InstallKmpWindow(Gtk.Dialog):
with tempfile.TemporaryDirectory() as tmpdirname:
extract_kmp(kmpfile, tmpdirname)
info, system, options, keyboards, files = get_metadata(tmpdirname)
if not keyboards:
# Likely not a keyboard .kmp file
logging.info("%s is not a Keyman keyboard package" % kmpfile)
dialog = Gtk.MessageDialog(viewkmp, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
_("The file '{kmpfile}' is not a Keyman keyboard package!").format(kmpfile=kmpfile))
dialog.run()
dialog.destroy()
self.checkcontinue = False
return
if len(keyboards) > 0 and 'name' in keyboards[0]:
self.kbname = keyboards[0]['name']
else: