Skip to content

Commit b14c978

Browse files
Simplify get_optional_attr() return statement
1 parent 8eddcb7 commit b14c978

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/mfast/xml_parser/xml_util.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ inline const char *get_optional_attr(const XMLElement &element,
1515
const char *attr_name,
1616
const char *default_value) {
1717
const XMLAttribute *attr = element.FindAttribute(attr_name);
18-
if (attr == nullptr) {
19-
return default_value;
20-
}
21-
return attr->Value();
18+
return attr ? attr->Value() : default_value;
2219
}
2320

2421
inline const char *string_dup(const char *str, arena_allocator &alloc) {

0 commit comments

Comments
 (0)