From ff0bfd754d621ae267861441f7b525dff1b0ab27 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Fri, 6 Jul 2012 12:03:15 +0200 Subject: [PATCH] git-remote-mediawiki: be more defensive when requests fail Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- contrib/mw-to-git/git-remote-mediawiki | 8 ++++++++ 1 file changed, 8 insertions(+) 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]; -- 2.26.2