瀏覽代碼

FIX: Error when browsing folder with Exif date 0-0-0 (fixes #693)

Alexander Koblov 2 年之前
父節點
當前提交
e1653703aa
共有 1 個文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/uwdxmodule.pas

+ 15 - 2
src/uwdxmodule.pas

@@ -787,6 +787,7 @@ function TPluginWDX.CallContentGetValueV(FileName: String; FieldIndex,
   UnitIndex: Integer; flags: Integer): Variant;
 var
   Rez: Integer;
+  ATime: TDateTime;
   Buf: array[0..WDX_MAX_LEN] of Byte;
   fnval: Integer absolute buf;
   fnval64: Int64 absolute buf;
@@ -807,8 +808,20 @@ begin
       ft_numeric_32: Result := fnval;
       ft_numeric_64: Result := fnval64;
       ft_numeric_floating: Result := ffval;
-      ft_date: Result := EncodeDate(fdate.wYear, fdate.wMonth, fdate.wDay);
-      ft_time: Result := EncodeTime(ftime.wHour, ftime.wMinute, ftime.wSecond, 0);
+      ft_date:
+        begin
+          if TryEncodeDate(fdate.wYear, fdate.wMonth, fdate.wDay, ATime) then
+            Result := ATime
+          else
+            Result := Unassigned;
+        end;
+      ft_time:
+        begin
+          if TryEncodeTime(ftime.wHour, ftime.wMinute, ftime.wSecond, 0, ATime) then
+            Result := ATime
+          else
+            Result := Unassigned;
+        end;
       ft_datetime: Result :=  WinFileTimeToDateTime(wtime);
       ft_boolean: Result := Boolean(fnval);