PKGBUILDs/extra/lensfun/lensfun-segfault.patch
2020-05-16 15:06:25 +00:00

63 lines
2 KiB
Diff

diff --git a/libs/lensfun/lens.cpp b/libs/lensfun/lens.cpp
index 52b76658..b8430609 100644
--- a/libs/lensfun/lens.cpp
+++ b/libs/lensfun/lens.cpp
@@ -66,9 +66,10 @@ lfLens::lfLens (const lfLens &other)
Mounts = NULL;
MountNames.clear();
const char* const* otherMounts = other.GetMountNames();
- for (int i = 0; otherMounts[i]; i++)
- AddMount(otherMounts[i]);
-
+ if (otherMounts) {
+ for (int i = 0; otherMounts[i]; i++)
+ AddMount(otherMounts[i]);
+ }
for (auto *calibset : other.Calibrations)
Calibrations.push_back(new lfLensCalibrationSet(*calibset));
@@ -96,9 +97,10 @@ lfLens &lfLens::operator = (const lfLens &other)
Mounts = NULL;
MountNames.clear();
const char* const* otherMounts = other.GetMountNames();
- for (int i = 0; otherMounts[i]; i++)
- AddMount(otherMounts[i]);
-
+ if (otherMounts) {
+ for (int i = 0; otherMounts[i]; i++)
+ AddMount(otherMounts[i]);
+ }
for (auto *calibset : Calibrations)
delete calibset;
Calibrations.clear();
diff --git a/libs/lensfun/mount.cpp b/libs/lensfun/mount.cpp
index bd875baa..86f667cb 100644
--- a/libs/lensfun/mount.cpp
+++ b/libs/lensfun/mount.cpp
@@ -28,8 +28,10 @@ lfMount::lfMount (const lfMount &other)
MountCompat.clear();
const char* const* otherMounts = other.GetCompats();
- for (int i = 0; otherMounts[i]; i++)
- AddCompat(otherMounts[i]);
+ if (otherMounts) {
+ for (int i = 0; otherMounts[i]; i++)
+ AddCompat(otherMounts[i]);
+ }
}
lfMount &lfMount::operator = (const lfMount &other)
@@ -40,9 +42,10 @@ lfMount &lfMount::operator = (const lfMount &other)
MountCompat.clear();
const char* const* otherMounts = other.GetCompats();
- for (int i = 0; otherMounts[i]; i++)
- AddCompat(otherMounts[i]);
-
+ if (otherMounts) {
+ for (int i = 0; otherMounts[i]; i++)
+ AddCompat(otherMounts[i]);
+ }
return *this;
}