summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2020-07-13 00:26:43 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2020-07-17 14:53:39 -0500
commit97c9cf3e21460a2292c108e676703cdeb826a22f (patch)
tree0fafee82afb9876edd225573e8479a02b03c740d /Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp
parent58aa0150e1d3d391d5fd4e04ab402afb10a60fcc (diff)
DolphinQt / InputCommon - add DSU string validator to avoid crashes, limited backwards compatibility support
Diffstat (limited to 'Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp b/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp
new file mode 100644
index 0000000000..1ab0935b53
--- /dev/null
+++ b/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp
@@ -0,0 +1,23 @@
+// Copyright 2020 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#include "DolphinQt/Config/ControllerInterface/ServerStringValidator.h"
+
+ServerStringValidator::ServerStringValidator(QObject* parent) : QValidator(parent)
+{
+}
+
+QValidator::State ServerStringValidator::validate(QString& input, int& pos) const
+{
+ if (input.isEmpty())
+ return Invalid;
+
+ if (input.contains(QStringLiteral(":")))
+ return Invalid;
+
+ if (input.contains(QStringLiteral(";")))
+ return Invalid;
+
+ return Acceptable;
+}