From 743a3f312cb82629e631eecaae57c448b1b57ce7 Mon Sep 17 00:00:00 2001 From: Loic d'Anterroches Date: Sun, 25 Jan 2009 20:48:02 +0100 Subject: [PATCH] Added a control to avoid redirecting to an inexisting branch. --- src/IDF/Views/Source.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 1fbbecf..409cbdd 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -64,6 +64,12 @@ class IDF_Views_Source $branches = $scm->getBranches(); $commit = $match[2]; if ('commit' != $scm->testHash($commit)) { + if (count($branches) == 0) { + // Redirect to the project source help + $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::help', + array($request->project->shortname)); + return new Pluf_HTTP_Response_Redirect($url); + } // Redirect to the first branch $url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::changeLog', array($request->project->shortname,