1
0
镜像自地址 https://github.com/arsenetar/dupeguru.git 已同步 2025-07-09 08:33:20 +00:00

[#140 state:fixed] Fixed a crash on dupe renaming.

这个提交包含在:
Virgil Dupras 2011-04-13 16:23:22 +02:00
父节点 f33f30eabf
当前提交 f28ffc680a
共有 2 个文件被更改,包括 11 次插入0 次删除

查看文件

@ -102,6 +102,10 @@ class ResultTable(GUIObject, GUITable):
def rename_selected(self, newname):
row = self.selected_row
if row is None:
# There's all kinds of way the current row can be swept off during rename. When it
# happens, selected_row will be None.
return False
row._data = None
row._data_delta = None
return self.app.rename_selected(newname)

查看文件

@ -136,6 +136,13 @@ class TestCaseDupeGuru:
app.start_scanning()
eq_(len(app.results.groups), 0)
def test_rename_when_nothing_is_selected(self):
# It's possible that rename operation has its selected row swept off from under it, thus
# making the selected row None. Don't crash when it happens.
dgapp = DupeGuru()
rtable = ResultTable(CallLogger(), dgapp)
# selected_row is None because there's no result.
assert not rtable.rename_selected('foo') # no crash
class TestCaseDupeGuru_clean_empty_dirs:
def pytest_funcarg__do_setup(self, request):