From d52e8fce790cc6ca1df90cb2105faa324711ed31 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Mon, 24 Jul 2023 18:55:59 -0400 Subject: [PATCH] clean up null checks on CameraModel/LensModel --- Program.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 3d40259..6164b43 100644 --- a/Program.cs +++ b/Program.cs @@ -144,8 +144,8 @@ void main() { public class Photo { public string File; public bool Loaded = false; - public string? CameraModel; - public string? LensModel; + public string CameraModel = ""; + public string LensModel = ""; public string FocalLength = ""; public string FNumber = ""; public string ExposureTime = ""; @@ -166,15 +166,16 @@ public class Photo { ExifProfile? exifs = image.Metadata.ExifProfile; if (exifs != null) { // FIXME: handle Orientation + // FIXME: handle date shot / edited (and sort by shot date?) IExifValue? model; if (exifs.TryGetValue(ExifTag.Model, out model)) { - CameraModel = model.Value; + CameraModel = model.Value ?? ""; } IExifValue? lensModel; if (exifs.TryGetValue(ExifTag.LensModel, out lensModel)) { - LensModel = lensModel.Value; + LensModel = lensModel.Value ?? ""; } IExifValue? focalLength;