From: Matthieu Moy Date: Fri, 6 Jul 2012 10:03:15 +0000 (+0200) Subject: git-remote-mediawiki: be more defensive when requests fail X-Git-Tag: v1.7.12-rc0~40^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff0bfd754d621ae267861441f7b525dff1b0ab27;p=git.git git-remote-mediawiki: be more defensive when requests fail Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki index 6bf1d1ad4..ff9384e91 100755 --- a/contrib/mw-to-git/git-remote-mediawiki +++ b/contrib/mw-to-git/git-remote-mediawiki @@ -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];