Skip to content

Commit 3fe3780

Browse files
committed
Fix attr handler choking on empty attributes
1 parent 3f87045 commit 3fe3780

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,10 @@ static map<const string, const function<void(myhtml_tree_node_t*)>> mode_handler
383383

384384
do{
385385
if(state["modearg"] == mycore_string_data(&attr->key)){
386-
fmt::print(format_node(node), mycore_string_data(&attr->value));
386+
const char* attr_value = mycore_string_data(&attr->value);
387+
if(attr_value != nullptr) {
388+
fmt::print(format_node(node), attr_value);
389+
}
387390
printf("%c", state["delim"][0]);
388391
}
389392
}while(attr != token->attr_last && (attr = attr->next)); // move attr pointer further & loop if attr_last not hit

0 commit comments

Comments
 (0)