diff --git a/src/Devture/Bundle/LocalizationBundle/Routing/LocaleAwareUrlGenerator.php b/src/Devture/Bundle/LocalizationBundle/Routing/LocaleAwareUrlGenerator.php
index <HASH>..<HASH> 100644
--- a/src/Devture/Bundle/LocalizationBundle/Routing/LocaleAwareUrlGenerator.php
+++ b/src/Devture/Bundle/LocalizationBundle/Routing/LocaleAwareUrlGenerator.php
@@ -20,7 +20,11 @@ class LocaleAwareUrlGenerator extends UrlGenerator {
 		$route = $this->routes->get($name);
 		if ($route instanceof Route) {
 			if (strpos($route->getPath(), '{locale}') !== false) {
-				$parameters['locale'] = $this->getRequest()->getLocale();
+				try {
+					$parameters['locale'] = $this->getRequest()->getLocale();
+				} catch (\RuntimeException $e) {
+					//Not running in a request context.
+				}
 			}
 		}
 		return parent::generate($name, $parameters, $absolute);
Don't break when not running in a request context