Close #3025 by fixing the fully defining the original selection function.

This commit is contained in:
Adam Reichold
2015-12-19 09:18:18 +01:00
parent 1650333b2a
commit 1ef2229ba4

View File

@@ -67,17 +67,19 @@ const Glib::ustring* getOriginalExtension (const ThumbBrowserEntryBase* entry)
ThumbBrowserEntryBase* selectOriginalEntry (ThumbBrowserEntryBase* original, ThumbBrowserEntryBase* candidate) ThumbBrowserEntryBase* selectOriginalEntry (ThumbBrowserEntryBase* original, ThumbBrowserEntryBase* candidate)
{ {
if (original == NULL) {
return candidate;
}
// The candidate will become the new original, if it has an original extension // The candidate will become the new original, if it has an original extension
// and if its extension is higher in the list than the old original. // and if its extension is higher in the list than the old original.
if (const Glib::ustring* candidateExtension = getOriginalExtension (candidate)) { if (const Glib::ustring* candidateExtension = getOriginalExtension (candidate)) {
if (original == NULL) { if (const Glib::ustring* originalExtension = getOriginalExtension (original)) {
return candidate;
} else if (const Glib::ustring* originalExtension = getOriginalExtension (original)) {
return candidateExtension < originalExtension ? candidate : original; return candidateExtension < originalExtension ? candidate : original;
} }
} else {
return original;
} }
return original;
} }
void findOriginalEntries (const std::vector<ThumbBrowserEntryBase*>& entries) void findOriginalEntries (const std::vector<ThumbBrowserEntryBase*>& entries)