Skip to content

Commit

Permalink
Fix infinite loop for URLRouter without any registered routes. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Jun 18, 2014
1 parent 2f4f3cf commit 9a3c31e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/vibe/http/router.d
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ private struct MatchTree(T) {

private Node* matchTerminals(string text)
{
if (!m_nodes.length) return null;

auto n = &m_nodes[0];

// follow the path through the match graph
Expand Down Expand Up @@ -575,6 +577,8 @@ private struct MatchTree(T) {
m_nodes = null;
m_terminalTags = null;

if (!m_terminals.length) return;

MatchGraphBuilder builder;
foreach (i, ref t; m_terminals)
t.varNames = builder.insert(t.pattern, i);
Expand Down Expand Up @@ -757,6 +761,8 @@ private struct MatchGraphBuilder {
void disambiguate()
{
//logInfo("Disambiguate");
if (!m_nodes.length) return;

import vibe.utils.hashmap;
HashMap!(immutable(size_t)[], size_t) combined_nodes;
auto visited = new bool[m_nodes.length * 2];
Expand Down

0 comments on commit 9a3c31e

Please sign in to comment.