You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Program received signal SIGSEGV, Segmentation fault.
0x000000555557f460 in crow::mustache::template_t::parse (this=0x7ffffef938)
at /usr/local/include/crow/mustache.h:521
521 auto& matched = actions_[blockPositions.back()];
(gdb) bt
#0 0x000000555557f460 in crow::mustache::template_t::parse (this=0x7ffffef938)
at /usr/local/include/crow/mustache.h:521
#1 0x000000555557d268 in crow::mustache::template_t::template_t (
this=0x7ffffef938, body="")
at /usr/local/include/crow/mustache.h:140
#2 0x0000005555580978 in crow::mustache::compile (
body="<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"/static/style.css\">\n <"...)
at /usr/local/include/crow/mustache.h:693
#3 0x00000055555810a0 in crow::mustache::load (filename="base.html")
at /usr/local/include/crow/mustache.h:816
#4 0x00000055555627b8 in main ()
at main.cpp:86
The code that loads the template:
auto basePage = crow::mustache::load("base.html");
The text was updated successfully, but these errors were encountered:
It's trying to get the last element of blockPositions in mustache::template_t::parse, but the list is empty. actions_ only has a single element.
A block begins with a dollar and ends with a slash. That is, {{$title}} begins a "title" block and {{/title}} ends it. {{$block}} doesn't add anything to blockPositions (there's no case '$', it falls into the default case): line 617 in crow/mustache.h
The error message about an unmatched pair only mentions the {{#-{{/ pair, which suggests at the fact that mustache {{$block}}s weren't taken into account at all while writing the closing tag code.
Digging into the spec, the {{$ tags specify inheritance, which is an optional component of mustache that unfortunately Crow doesn't support. Which explains why they're not being taken into account.
The bug here is that Crow doesn't mention this information when an inheritance tag is used.
The code that loads the template:
The text was updated successfully, but these errors were encountered: