Fix crash when using get_data() on new, empty choices.
authorCarl Hetherington <cth@carlh.net>
Tue, 6 May 2025 15:53:09 +0000 (17:53 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 7 May 2025 23:29:35 +0000 (01:29 +0200)
Due to the dummy item that we have to add.

src/wx/dcpomatic_choice.cc

index 5b3b9fb48b751ed5865b1ead0891e76604104faa..270ab72ad15d9e33dbf7963906c9f33d22d89bba 100644 (file)
@@ -144,6 +144,9 @@ Choice::get() const
 optional<string>
 Choice::get_data() const
 {
+       if (size() == 0) {
+               return {};
+       }
 
        auto index = get();
        if (!index) {