diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-22 20:46:55 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2003-01-22 20:46:55 +0000 |
commit | d0532e6c480f0bd09a55180e0e26deb5b6b85244 (patch) | |
tree | 7aa2c8a149622e7fa74914a39f357e9765b496b9 | |
parent | ff1337faad66dfbf06ef34b51f24bbeb631a07bf (diff) | |
download | rpmdrake-d0532e6c480f0bd09a55180e0e26deb5b6b85244.tar rpmdrake-d0532e6c480f0bd09a55180e0e26deb5b6b85244.tar.gz rpmdrake-d0532e6c480f0bd09a55180e0e26deb5b6b85244.tar.bz2 rpmdrake-d0532e6c480f0bd09a55180e0e26deb5b6b85244.tar.xz rpmdrake-d0532e6c480f0bd09a55180e0e26deb5b6b85244.zip |
fix crashing when managing to call Remove or Edit with nothing
selected (#970)
-rwxr-xr-x | edit-urpm-sources.pl | 9 | ||||
-rw-r--r-- | rpmdrake.spec | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl index 587017c9..d05a582c 100755 --- a/edit-urpm-sources.pl +++ b/edit-urpm-sources.pl @@ -150,6 +150,7 @@ really want to replace it?"), yesno => 1) or return 0; sub selrow { my ($model, $iter) = $list_tv->get_selection->get_selected; + $model && $iter or return -1; my $path = $model->get_path($iter); my $row = $path->to_string; $path->free; @@ -158,8 +159,10 @@ sub selrow { } sub remove_callback { + my $row = selrow(); + $row == -1 and return; my $wait = wait_msg(N("Please wait, removing medium...")); - my $name = $urpm->{media}[selrow()]{name}; + my $name = $urpm->{media}[$row]{name}; standalone::explanations("Removing medium $name"); $urpm->select_media($name); $urpm->remove_selected_media; @@ -168,7 +171,9 @@ sub remove_callback { } sub edit_callback { - my $medium = $urpm->{media}[selrow()]; + my $row = selrow(); + $row == -1 and return; + my $medium = $urpm->{media}[$row]; my $w = ugtk2->new(N("Edit a source"), grab => 1, center => 1, transient => $mainw->{rwindow}); my ($url_entry, $hdlist_entry, $url, $with_hdlist); gtkadd($w->{window}, diff --git a/rpmdrake.spec b/rpmdrake.spec index 7d060117..7b20685d 100644 --- a/rpmdrake.spec +++ b/rpmdrake.spec @@ -120,6 +120,8 @@ rm -rf $RPM_BUILD_ROOT - edit-urpm-sources: - fix wrong display of medium as "enabled", after adding a medium that has problems and is hence automatically disabled (#995) + - fix crashing when managing to call Remove or Edit with nothing + selected (#970) * Tue Jan 21 2003 Guillaume Cottenceau <gc@mandrakesoft.com> 2.1-3mdk - rpmdrake: |