Using a snippet in a route

My site has events as sub-pages of the events page. I want to generate an ical file for an event when the url is pointed to events/event-name/ical. I am trying to get setup a route that will return the ical snippet with the appropriate data. However, I keep getting this:

Notice: Trying to get property of non-object in /var/www/html/kirby/branches/multilang/site.php on line 187

Fatal error: Call to a member function code() on a non-object in /var/www/html/kirby/kirby.php on line 412

It appears to be some kind of problem with Kirby’s multi-language system, but I don’t know what the problem is. Here’s the routing code:

c::set('routes', array (
	array (
		'pattern' => "events/(:any)/ical",
		'action'  => function($event) {
			$eventPage = page("events/" . $event);
			$content = snippet("ical", ["page" => $eventPage], true);
			$response = new Response( $content );
			return $response;
		}
	)
));

Thank you!

It turns out that the visit function of the site object (which apparently sets the language) wasn’t being called. (Which makes sense, the page wasn’t being visited.) As a result, when whatever function needed the language tried to call the locale function, the language wasn’t there to get. I solved putting in my route:

site()->visit("events/" . $event);

I feel that this isn’t the right answer though. Are snippets just not meant to be used in routes?