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.

(cherry picked from commit 70452321ce)
This commit is contained in:
lzwind lzwind
2025-03-03 13:21:37 +00:00
committed by Kurt Hindenburg
parent 2462393892
commit 978613a529

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;