2
0
Эх сурвалжийг харах

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

Alexander Koblov 2 жил өмнө
parent
commit
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);