forked from qt-creator/qt-creator
FilePath: Return optional bytearray for file contents
For differentiating between "error" and "empty file". Change-Id: I2c019ceac625e7be3180afa4d47ae3a24df91c1d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -129,7 +129,10 @@ static QList<GitLabServer> readTokensFile(const Utils::FilePath &filePath)
|
||||
{
|
||||
if (!filePath.exists())
|
||||
return {};
|
||||
const QByteArray content = filePath.fileContents();
|
||||
std::optional<QByteArray> contents = filePath.fileContents();
|
||||
if (!contents)
|
||||
return {};
|
||||
const QByteArray content = *contents;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(content);
|
||||
if (!doc.isArray())
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user