Return early when SSH config file cannot be opened

When attempting to import SSH configurations, the code previously continued
execution even when the config file could not be opened. This could lead
to undefined behavior or crashes when trying to read from an invalid file
handle.

The fix adds an early return statement when file opening fails, ensuring
proper error handling and preventing potential issues downstream.
This commit is contained in:
lzwind lzwind
2025-03-03 13:21:37 +00:00
committed by Kurt Hindenburg
parent 7f3739e023
commit 70452321ce

View File

@@ -332,6 +332,7 @@ void SSHManagerModel::importFromSshConfigFile(const QString &file)
QFile sshConfig(file);
if (!sshConfig.open(QIODevice::ReadOnly)) {
qCDebug(SshManagerPluginDebug) << "Can't open config file";
return;
}
QTextStream stream(&sshConfig);
QString line;