浏览代码

LibGfx/TIFF: Expose default value for numerical tags too

Due to the integer -> bool conversion rule, the condition was wrong. We
actually want to test for a not `None` state.
Lucas CHOLLET 1 年之前
父节点
当前提交
a9a5ca6754
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibGfx/TIFFGenerator.py

+ 1 - 1
Userland/Libraries/LibGfx/TIFFGenerator.py

@@ -313,7 +313,7 @@ def generate_getter(tag: Tag) -> str:
 
 
     signature = fR"    Optional<{return_type}> {pascal_case_to_snake_case(tag.name)}() const"
     signature = fR"    Optional<{return_type}> {pascal_case_to_snake_case(tag.name)}() const"
 
 
-    if tag.default and single_count:
+    if tag.default is not None and single_count:
         return_if_empty = f'{default_value_to_cpp(tag.default)}'
         return_if_empty = f'{default_value_to_cpp(tag.default)}'
     else:
     else:
         return_if_empty = 'OptionalNone {}'
         return_if_empty = 'OptionalNone {}'