mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 09:47:36 +02:00
chore: raise error on Nonetype model
This commit is contained in:
parent
88c4758c6b
commit
aa6b94905a
@ -70,6 +70,8 @@ class ModTreeView(ModsMixin, ContextMixin, TreeView): # type: ignore
|
||||
def get_selected_mod(self) -> str:
|
||||
path = self.get_focused_row_path()
|
||||
model = self.get_model()
|
||||
if model is None:
|
||||
raise AttributeError("Trying to call a method on a non-existent model")
|
||||
tree_iter = model.get_iter(path)
|
||||
mod = model.get(tree_iter, 2)[0]
|
||||
return str(mod)
|
||||
|
||||
@ -61,6 +61,8 @@ class ServerModTreeView(ContextMixin, TreeView): # type: ignore
|
||||
def get_selected_mod(self) -> str:
|
||||
path = self.get_focused_row_path()
|
||||
model = self.get_model()
|
||||
if model is None:
|
||||
raise AttributeError("Trying to call a method on a non-existent model")
|
||||
tree_iter = model.get_iter(path)
|
||||
# FIXME: https://docs.gtk.org/gtk3/method.TreeModel.get.html
|
||||
mod = model.get(tree_iter, 1)[0]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user