Skip to content

Commit

Permalink
fixed bugs in the source
Browse files Browse the repository at this point in the history
  • Loading branch information
polettix committed Oct 2, 2012
1 parent 5c45074 commit ae163bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions lib/Narsil/Frontend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,18 @@ get '/match/:id' => sub {
my $userid = user()->{username};

my $matchid = param('id');
my $match = get_match($matchid) or do {
flash error => no_match => $matchid;
return redirect request.uri_for('/');
};

my $game = get_game($match->{game}) or do {
flash error => no_game => $match->{game};
return redirect request.uri_for('/');
my ($match, $game);
try {
$match = get_match($matchid) or do {
flash error => no_match => $matchid;
die {};
};
$game = get_game($match->{game}) or do {
flash error => no_game => $match->{game};
die {};
};
};
return redirect request()->uri_for('/') unless defined $game;

my $gameid = $game->{id};
my $template = "games/$gameid";
Expand Down Expand Up @@ -304,7 +307,7 @@ post '/match' => sub {
catch {
warning "caught error during forward: $_";
};
return redirect request . uri_for('/');
return redirect request()->uri_for('/');
};

post '/match/joins/:id' => sub {
Expand All @@ -323,7 +326,7 @@ post '/match/joins/:id' => sub {
else {
flash warning => 'join_pending';
}
return redirect '/';
return redirect request()->uri_for('/');
};

post '/move' => sub {
Expand Down Expand Up @@ -357,7 +360,7 @@ post '/move' => sub {
};

#flash info => debug => to_json($move);
return redirect "/match/$matchid";
return redirect request()->uri_for("/match/$matchid");
};

get '/game/:id' => sub {
Expand Down
2 changes: 1 addition & 1 deletion views/layouts/main_/flash/no_match.tt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Match <% report.2 | html > does not exist
Match <% report.2 | html %> does not exist

0 comments on commit ae163bc

Please sign in to comment.