diff options
-rw-r--r-- | src/gui/models/colormodel.cpp | 2 | ||||
-rw-r--r-- | src/gui/models/namesmodel.cpp | 2 | ||||
-rw-r--r-- | src/gui/models/serverslistmodel.h | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/models/colormodel.cpp b/src/gui/models/colormodel.cpp index 212ed5227..f7b18d300 100644 --- a/src/gui/models/colormodel.cpp +++ b/src/gui/models/colormodel.cpp @@ -70,6 +70,8 @@ void ColorModel::add(const std::string &name, const Color *const color1, ColorModel *ColorModel::createDefault(const Widget2 *const widget) { ColorModel *const model = new ColorModel(); + if (!widget) + return model; // TRANSLATORS: color name addColor(_("black"), BLACK); // TRANSLATORS: color name diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp index ed0d78269..b3137d264 100644 --- a/src/gui/models/namesmodel.cpp +++ b/src/gui/models/namesmodel.cpp @@ -47,6 +47,8 @@ std::string NamesModel::getElementAt(int i) void NamesModel::fillFromArray(const char *const *const arr, std::size_t sz) { + if (!arr) + return; for (size_t f = 0; f < sz; f ++) mNames.push_back(gettext(arr[f])); } diff --git a/src/gui/models/serverslistmodel.h b/src/gui/models/serverslistmodel.h index 864cc70c6..d3d0aec26 100644 --- a/src/gui/models/serverslistmodel.h +++ b/src/gui/models/serverslistmodel.h @@ -42,7 +42,8 @@ class ServersListModel final : public ListModel ServersListModel(ServerInfos *const servers, ServerDialog *const parent) : mServers(servers), - mVersionStrings(servers->size(), VersionString(0, "")), + mVersionStrings(servers ? servers->size() : 0, + VersionString(0, "")), mParent(parent) { } |