added error handling for importing a native config
This commit is contained in:
parent
915fb6759a
commit
33f49bfddb
2 changed files with 6 additions and 5 deletions
|
@ -103,15 +103,15 @@ bool ImportController::extractConfigFromData(QString data)
|
|||
switch (configFormat) {
|
||||
case ConfigTypes::OpenVpn: {
|
||||
m_config = extractOpenVpnConfig(config);
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::WireGuard: {
|
||||
m_config = extractWireGuardConfig(config);
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::Amnezia: {
|
||||
m_config = QJsonDocument::fromJson(config.toUtf8()).object();
|
||||
return true;
|
||||
return m_config.empty() ? false : true;
|
||||
}
|
||||
case ConfigTypes::Backup: {
|
||||
if (!m_serversModel->getServersCount()) {
|
||||
|
|
|
@ -77,8 +77,9 @@ PageType {
|
|||
text: qsTr("Continue")
|
||||
|
||||
clickedFunc: function() {
|
||||
ImportController.extractConfigFromData(textKey.textFieldText)
|
||||
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
if (ImportController.extractConfigFromData(textKey.textFieldText)) {
|
||||
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue