aboutsummaryrefslogtreecommitdiff
path: root/src/session
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-01-18 16:56:54 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2019-01-18 16:56:54 +0100
commit9e73d0dac0774955348a5164087363c5b33927b8 (patch)
tree61eb5d729c4e48e1fabe596f387a3e67a1d1d415 /src/session
parentRewrite lib/web to lib/webprofile (diff)
downloadsmolbote-9e73d0dac0774955348a5164087363c5b33927b8.tar.xz
Add tools/report-clang-tidy.sh
- Fix various clang-tidy warnings - Fix use-after-free crash when deleting profiles
Diffstat (limited to 'src/session')
-rw-r--r--src/session/session.cpp2
-rw-r--r--src/session/sessiondialog.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/session/session.cpp b/src/session/session.cpp
index 51575bf..67cea70 100644
--- a/src/session/session.cpp
+++ b/src/session/session.cpp
@@ -120,7 +120,7 @@ void Session::restoreView(WebView *view, const QJsonObject &data)
Q_CHECK_PTR(profileManager);
auto *profile = profileManager->profile(data["profile"].toString());
- if(profile)
+ if(profile != nullptr)
view->setProfile(profile);
auto url = data.value("url");
diff --git a/src/session/sessiondialog.cpp b/src/session/sessiondialog.cpp
index 184c44d..b734088 100644
--- a/src/session/sessiondialog.cpp
+++ b/src/session/sessiondialog.cpp
@@ -35,11 +35,11 @@ SessionDialog::SessionDialog(QWidget *parent)
connect(ui->listWidget, &QListWidget::currentItemChanged, this, [this](QListWidgetItem *currentItem, QListWidgetItem *previousItem) {
auto *currentWidget = qobject_cast<SessionForm *>(ui->listWidget->itemWidget(currentItem));
- if(currentWidget)
+ if(currentWidget != nullptr)
currentWidget->ui->delete_toolButton->show();
auto *previousWidget = qobject_cast<SessionForm *>(ui->listWidget->itemWidget(previousItem));
- if(previousWidget)
+ if(previousWidget != nullptr)
previousWidget->ui->delete_toolButton->hide();
});
@@ -53,7 +53,7 @@ SessionDialog::SessionDialog(QWidget *parent)
accepted_connection = connect(this, &SessionDialog::accepted, this, [this, browser]() {
auto *currentWidget = qobject_cast<SessionForm *>(ui->listWidget->itemWidget(ui->listWidget->currentItem()));
- if(currentWidget)
+ if(currentWidget != nullptr)
this->openSession(currentWidget->ui->label->text());
else
browser->createWindow();
@@ -76,7 +76,7 @@ std::optional<QJsonObject> SessionDialog::pickSession()
}
auto *currentWidget = qobject_cast<SessionForm *>(ui->listWidget->itemWidget(ui->listWidget->currentItem()));
- if(currentWidget) {
+ if(currentWidget != nullptr) {
QFile json(currentWidget->ui->label->text());
if(json.open(QIODevice::ReadOnly | QIODevice::Text)) {
auto doc = QJsonDocument::fromJson(json.readAll());