git-remote-mediawiki: be more defensive when requests fail

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matthieu Moy 2012-07-06 12:03:15 +02:00 committed by Junio C Hamano
parent 5a29217dda
commit ff0bfd754d

View File

@ -912,6 +912,14 @@ sub mw_import_revids {
my $result = $mediawiki->api($query);
if (!$result) {
die "Failed to retrieve modified page for revision $pagerevid";
}
if (!defined($result->{query}->{pages})) {
die "Invalid revision $pagerevid.";
}
my @result_pages = values(%{$result->{query}->{pages}});
my $result_page = $result_pages[0];
my $rev = $result_pages[0]->{revisions}->[0];