From 4a7b6d7e8fcf68d470ce171622b660fcdc6db34b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Jan 2021 00:08:30 +0100 Subject: [PATCH] Document that index must be valid in wxChoice::GetString() This is now the case in all ports, and not just in wxOSX, so document this behaviour and also document that it has changed compared to 3.0. --- docs/changes.txt | 2 ++ interface/wx/ctrlsub.h | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 43013289be..a80274f466 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -107,6 +107,8 @@ Changes in behaviour not resulting in compilation errors - wxGetInstallPrefix() now returns wxString. +- wxChoice::GetString() now consistently asserts when passed an invalid index. + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/interface/wx/ctrlsub.h b/interface/wx/ctrlsub.h index 68fb7f8980..e246e6a26c 100644 --- a/interface/wx/ctrlsub.h +++ b/interface/wx/ctrlsub.h @@ -51,11 +51,14 @@ public: /** Returns the label of the item with the given index. + The index must be valid, i.e. less than the value returned by + GetCount(), otherwise an assert is triggered. Notably, this function + can't be called if the control is empty. + @param n The zero-based index. - @return The label of the item or an empty string if the position was - invalid. + @return The label of the item. */ virtual wxString GetString(unsigned int n) const = 0;