Commit a540e6fd authored by Kurt Hindenburg's avatar Kurt Hindenburg

Fix readability-implicit-bool-cast issues using nullptr

parent 29382cc6
......@@ -523,7 +523,7 @@ Profile::Ptr Application::processProfileChangeArgs(Profile::Ptr baseProfile)
void Application::startBackgroundMode(MainWindow* window)
{
if (_backgroundInstance) {
if (_backgroundInstance != nullptr) {
return;
}
......
......@@ -101,7 +101,7 @@ QUrl BookmarkHandler::currentUrl() const
QUrl BookmarkHandler::urlForView(ViewProperties* view) const
{
if (view)
if (view != nullptr)
return QUrl(view->url());
else
return QUrl();
......@@ -114,7 +114,7 @@ QString BookmarkHandler::currentTitle() const
QString BookmarkHandler::titleForView(ViewProperties* view) const
{
const QUrl& url = view ? view->url() : QUrl();
const QUrl& url = view != nullptr ? view->url() : QUrl();
if (url.isLocalFile()) {
QString path = url.path();
......@@ -139,7 +139,7 @@ QString BookmarkHandler::currentIcon() const
QString BookmarkHandler::iconForView(ViewProperties* view) const
{
if (view)
if (view != nullptr)
return view->icon().name();
else
return QString();
......
......@@ -219,7 +219,7 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry)
{
Q_ASSERT(index >= 0 && index < TABLE_COLORS);
if (!_table) {
if (_table == nullptr) {
_table = new ColorEntry[TABLE_COLORS];
for (int i = 0; i < TABLE_COLORS; i++)
......@@ -292,7 +292,7 @@ void ColorScheme::setRandomizedBackgroundColor(bool randomize)
if (randomize) {
setRandomizationRange(BGCOLOR_INDEX , MAX_HUE , 255 , 0);
} else {
if (_randomTable)
if (_randomTable != nullptr)
setRandomizationRange(BGCOLOR_INDEX , 0 , 0 , 0);
}
}
......@@ -313,7 +313,7 @@ void ColorScheme::setRandomizationRange(int index , quint16 hue , quint8 saturat
const ColorEntry* ColorScheme::colorTable() const
{
if (_table)
if (_table != nullptr)
return _table;
else
return defaultTable;
......@@ -449,7 +449,7 @@ void ColorSchemeWallpaper::load()
return;
// Create and load original pixmap
if (!_picture)
if (_picture == nullptr)
_picture = new QPixmap();
if (_picture->isNull())
......@@ -463,7 +463,7 @@ bool ColorSchemeWallpaper::isNull() const
bool ColorSchemeWallpaper::draw(QPainter& painter, const QRect& rect, qreal opacity)
{
if (!_picture || _picture->isNull())
if ((_picture == nullptr) || _picture->isNull())
return false;
if (qFuzzyCompare(1.0, opacity)) {
......
......@@ -209,7 +209,7 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString& path)
}
void ColorSchemeEditor::setDescription(const QString& text)
{
if (_colors)
if (_colors != nullptr)
_colors->setDescription(text);
if (_ui->descriptionEdit->text() != text)
......
......@@ -85,7 +85,7 @@ CopyInputDialog::~CopyInputDialog()
void CopyInputDialog::setChosenSessions(const QSet<Session*>& sessions)
{
QSet<Session*> checked = sessions;
if (_masterSession)
if (_masterSession != nullptr)
checked.insert(_masterSession);
_model->setCheckedSessions(checked);
......@@ -96,7 +96,7 @@ QSet<Session*> CopyInputDialog::chosenSessions() const
}
void CopyInputDialog::setMasterSession(Session* session)
{
if (_masterSession)
if (_masterSession != nullptr)
_model->setCheckable(_masterSession, true);
_model->setCheckable(session, false);
......
......@@ -490,7 +490,7 @@ void EditProfileDialog::toggleMouseWheelZoom(bool enable)
}
void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
{
if (!_ui->colorSchemeList->model())
if (_ui->colorSchemeList->model() == nullptr)
_ui->colorSchemeList->setModel(new QStandardItemModel(this));
const QString& name = lookupProfile()->colorScheme();
......@@ -520,7 +520,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
model->sort(0);
if (selectCurrentScheme && selectedItem) {
if (selectCurrentScheme && (selectedItem != nullptr)) {
_ui->colorSchemeList->updateGeometry();
_ui->colorSchemeList->selectionModel()->setCurrentIndex(selectedItem->index() ,
QItemSelectionModel::Select);
......@@ -531,7 +531,7 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme)
}
void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
{
if (!_ui->keyBindingList->model())
if (_ui->keyBindingList->model() == nullptr)
_ui->keyBindingList->setModel(new QStandardItemModel(this));
const QString& name = lookupProfile()->keyBindings();
......@@ -550,7 +550,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
QStringList translatorNames = keyManager->allTranslators();
foreach(const QString& translatorName, translatorNames) {
const KeyboardTranslator* translator = keyManager->findTranslator(translatorName);
if (!translator) continue;
if (translator == nullptr) continue;
QStandardItem* item = new QStandardItem(translator->description());
item->setEditable(false);
......@@ -566,7 +566,7 @@ void EditProfileDialog::updateKeyBindingsList(bool selectCurrentTranslator)
model->sort(0);
if (selectCurrentTranslator && selectedItem) {
if (selectCurrentTranslator && (selectedItem != nullptr)) {
_ui->keyBindingList->selectionModel()->setCurrentIndex(selectedItem->index() ,
QItemSelectionModel::Select);
}
......@@ -689,7 +689,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
// Setting up ColorSchemeEditor ui
// close any running ColorSchemeEditor
if (_colorDialog) {
if (_colorDialog != nullptr) {
closeColorSchemeEditor();
}
_colorDialog = new ColorSchemeEditor(this);
......@@ -701,7 +701,7 @@ void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
}
void EditProfileDialog::closeColorSchemeEditor()
{
if (_colorDialog) {
if (_colorDialog != nullptr) {
_colorDialog->close();
delete _colorDialog;
}
......@@ -736,7 +736,7 @@ void EditProfileDialog::colorSchemeSelected()
if (!selected.isEmpty()) {
QAbstractItemModel* model = _ui->colorSchemeList->model();
const ColorScheme* colors = model->data(selected.first(), Qt::UserRole + 1).value<const ColorScheme*>();
if (colors) {
if (colors != nullptr) {
updateTempProfileProperty(Profile::ColorScheme, colors->name());
previewColorScheme(selected.first());
......@@ -841,7 +841,7 @@ void EditProfileDialog::keyBindingSelected()
QAbstractItemModel* model = _ui->keyBindingList->model();
const KeyboardTranslator* translator = model->data(selected.first(), Qt::UserRole + 1)
.value<const KeyboardTranslator*>();
if (translator) {
if (translator != nullptr) {
updateTempProfileProperty(Profile::KeyBindings, translator->name());
}
}
......@@ -885,7 +885,7 @@ void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
auto editor = new KeyBindingEditor;
if (translator)
if (translator != nullptr)
editor->setup(translator);
if (isNewTranslator)
......@@ -1295,13 +1295,13 @@ void ColorSchemeViewDelegate::paint(QPainter* painter, const QStyleOptionViewIte
const ColorScheme* scheme = index.data(Qt::UserRole + 1).value<const ColorScheme*>();
QFont profileFont = index.data(Qt::UserRole + 2).value<QFont>();
Q_ASSERT(scheme);
if (!scheme)
if (scheme == nullptr)
return;
painter->setRenderHint(QPainter::Antialiasing);
// Draw background
QStyle *style = option.widget ? option.widget->style() : QApplication::style();
QStyle *style = option.widget != nullptr ? option.widget->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, option.widget);
// Draw name
......
......@@ -143,7 +143,7 @@ const HistoryType& Emulation::history() const
void Emulation::setCodec(const QTextCodec * codec)
{
if (codec) {
if (codec != nullptr) {
_codec = codec;
delete _decoder;
......@@ -166,7 +166,7 @@ void Emulation::setCodec(EmulationCodec codec)
void Emulation::setKeyBindings(const QString& name)
{
_keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name);
if (!_keyTranslator) {
if (_keyTranslator == nullptr) {
_keyTranslator = KeyboardTranslatorManager::instance()->defaultTranslator();
}
}
......
......@@ -115,7 +115,7 @@ ushort* ExtendedCharTable::lookupExtendedChar(ushort hash , ushort& length) cons
// argument and return a pointer to the character sequence
ushort* buffer = extendedCharTable[hash];
if (buffer) {
if (buffer != nullptr) {
length = buffer[0];
return buffer + 1;
} else {
......
......@@ -358,7 +358,7 @@ void RegExpFilter::process()
RegExpFilter::HotSpot* spot = newHotSpot(startLine, startColumn,
endLine, endColumn, match.capturedTexts());
if (!spot) {
if (spot == nullptr) {
continue;
}
......@@ -405,14 +405,14 @@ void UrlFilter::HotSpot::activate(QObject* object)
const UrlType kind = urlType();
const QString& actionName = object ? object->objectName() : QString();
const QString& actionName = object != nullptr ? object->objectName() : QString();
if (actionName == QLatin1String("copy-action")) {
QApplication::clipboard()->setText(url);
return;
}
if (!object || actionName == QLatin1String("open-action")) {
if ((object == nullptr) || actionName == QLatin1String("open-action")) {
if (kind == StandardUrl) {
// if the URL path does not include the protocol ( eg. "www.kde.org" ) then
// prepend http:// ( eg. "www.kde.org" --> "http://www.kde.org" )
......@@ -501,7 +501,7 @@ QList<QAction*> UrlFilter::HotSpot::actions()
RegExpFilter::HotSpot* FileFilter::newHotSpot(int startLine, int startColumn, int endLine,
int endColumn, const QStringList& capturedTexts)
{
if (!_session) {
if (_session == nullptr) {
qCDebug(KonsoleDebug) << "Trying to create new hot spot without session!";
return nullptr;
}
......
......@@ -91,7 +91,7 @@ HistoryFile::HistoryFile()
HistoryFile::~HistoryFile()
{
if (_fileMap)
if (_fileMap != nullptr)
unmap();
}
......@@ -128,7 +128,7 @@ bool HistoryFile::isMapped() const
void HistoryFile::add(const unsigned char* buffer, int count)
{
if (_fileMap)
if (_fileMap != nullptr)
unmap();
_readWriteBalance++;
......@@ -155,7 +155,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc)
//calls (decided by using MAP_THRESHOLD) then mmap the log
//file to improve performance.
_readWriteBalance--;
if (!_fileMap && _readWriteBalance < MAP_THRESHOLD)
if ((_fileMap == nullptr) && _readWriteBalance < MAP_THRESHOLD)
map();
if (loc < 0 || size < 0 || loc + size > _length) {
......@@ -163,7 +163,7 @@ void HistoryFile::get(unsigned char* buffer, int size, int loc)
return;
}
if (_fileMap) {
if (_fileMap != nullptr) {
for (int i = 0; i < size; i++)
buffer[i] = _fileMap[loc + i];
} else {
......@@ -607,7 +607,7 @@ bool HistoryTypeFile::isEnabled() const
HistoryScroll* HistoryTypeFile::scroll(HistoryScroll* old) const
{
if (dynamic_cast<HistoryFile *>(old))
if (dynamic_cast<HistoryFile *>(old) != nullptr)
return old; // Unchanged.
HistoryScroll* newScroll = new HistoryScrollFile(_fileName);
......@@ -657,9 +657,9 @@ int CompactHistoryType::maximumLineCount() const
HistoryScroll* CompactHistoryType::scroll(HistoryScroll* old) const
{
if (old) {
if (old != nullptr) {
CompactHistoryScroll* oldBuffer = dynamic_cast<CompactHistoryScroll*>(old);
if (oldBuffer) {
if (oldBuffer != nullptr) {
oldBuffer->setMaxNbLines(_maxLines);
return oldBuffer;
}
......
......@@ -158,7 +158,7 @@ void KeyBindingEditor::setDescription(const QString& newDescription)
void KeyBindingEditor::setTranslatorDescription(const QString& newDescription)
{
if (_translator)
if (_translator != nullptr)
_translator->setDescription(newDescription);
}
......
......@@ -189,7 +189,7 @@ const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator()
// Try to find the default.keytab file if it exists, otherwise
// fall back to the internal hard-coded fallback translator
const KeyboardTranslator* translator = findTranslator(QStringLiteral("default"));
if (!translator) {
if (translator == nullptr) {
translator = _fallbackTranslator;
}
return translator;
......
......@@ -174,7 +174,7 @@ void MainWindow::correctStandardShortcuts()
{
// replace F1 shortcut for help contents
QAction* helpAction = actionCollection()->action(QStringLiteral("help_contents"));
if (helpAction) {
if (helpAction != nullptr) {
actionCollection()->setDefaultShortcut(helpAction, QKeySequence());
}
......@@ -182,7 +182,7 @@ void MainWindow::correctStandardShortcuts()
// changed the shortcut; however, if the user changed it to Ctrl+B
// this will still get changed to Ctrl+Shift+B
QAction* bookmarkAction = actionCollection()->action(QStringLiteral("add_bookmark"));
if (bookmarkAction && bookmarkAction->shortcut() == QKeySequence(Konsole::ACCEL + Qt::Key_B)) {
if ((bookmarkAction != nullptr) && bookmarkAction->shortcut() == QKeySequence(Konsole::ACCEL + Qt::Key_B)) {
actionCollection()->setDefaultShortcut(bookmarkAction, Konsole::ACCEL + Qt::SHIFT + Qt::Key_B);
}
}
......@@ -218,7 +218,7 @@ void MainWindow::activeViewChanged(SessionController* controller)
disconnect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, 0, 0);
connect(bookmarkHandler(), &Konsole::BookmarkHandler::openUrl, controller, &Konsole::SessionController::openUrl);
if (_pluggedController)
if (_pluggedController != nullptr)
disconnectController(_pluggedController);
Q_ASSERT(controller);
......@@ -250,7 +250,7 @@ void MainWindow::activeViewTitleChanged(ViewProperties* properties)
void MainWindow::updateWindowCaption()
{
if (!_pluggedController)
if (_pluggedController == nullptr)
return;
const QString& title = _pluggedController->title();
......@@ -273,7 +273,7 @@ void MainWindow::updateWindowCaption()
void MainWindow::updateWindowIcon()
{
if (_pluggedController && !_pluggedController->icon().isNull())
if ((_pluggedController != nullptr) && !_pluggedController->icon().isNull())
setWindowIcon(_pluggedController->icon());
}
......@@ -374,7 +374,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
// it if it is the non-default profile.
if (sessionActions.size() > 2) {
// Update the 'New Tab' KActionMenu
if (_newTabMenuAction->menu()) {
if (_newTabMenuAction->menu() != nullptr) {
_newTabMenuAction->menu()->clear();
} else {
_newTabMenuAction->setMenu(new QMenu());
......@@ -394,7 +394,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
}
}
} else {
if (_newTabMenuAction->menu()) {
if (_newTabMenuAction->menu() != nullptr) {
_newTabMenuAction->menu()->clear();
} else {
_newTabMenuAction->setMenu(new QMenu());
......@@ -412,7 +412,7 @@ void MainWindow::profileListChanged(const QList<QAction*>& sessionActions)
QString MainWindow::activeSessionDir() const
{
if (_pluggedController) {
if (_pluggedController != nullptr) {
if (Session* session = _pluggedController->session()) {
// For new tabs to get the correct working directory,
// force the updating of the currentWorkingDirectory.
......@@ -536,7 +536,7 @@ bool MainWindow::queryClose()
// Check what processes are running, excluding the shell
QStringList processesRunning;
foreach(Session *session, _viewManager->sessions()) {
if (!session || !session->isForegroundProcessActive()) {
if ((session == nullptr) || !session->isForegroundProcessActive()) {
continue;
}
......@@ -600,7 +600,7 @@ bool MainWindow::queryClose()
case KMessageBox::Yes:
return true;
case KMessageBox::No:
if (_pluggedController && _pluggedController->session()) {
if ((_pluggedController != nullptr) && (_pluggedController->session() != nullptr)) {
disconnectController(_pluggedController);
_pluggedController->session()->closeInNormalWay();
}
......@@ -654,7 +654,7 @@ void MainWindow::showShortcutsDialog()
// sync shortcuts for non-session actions (defined in "konsoleui.rc") in other main windows
foreach(QWidget* mainWindowWidget, QApplication::topLevelWidgets()) {
MainWindow* mainWindow = qobject_cast<MainWindow*>(mainWindowWidget);
if (mainWindow && mainWindow != this)
if ((mainWindow != nullptr) && mainWindow != this)
syncActiveShortcuts(mainWindow->actionCollection(), actionCollection());
}
// sync shortcuts for session actions (defined in "sessionui.rc") in other session controllers.
......@@ -663,7 +663,7 @@ void MainWindow::showShortcutsDialog()
// when they are plugged into a main window.
foreach(SessionController * controller, SessionController::allControllers()) {
controller->reloadXML();
if (controller->factory() && controller != _pluggedController)
if ((controller->factory() != nullptr) && controller != _pluggedController)
syncActiveShortcuts(controller->actionCollection(), _pluggedController->actionCollection());
}
}
......
......@@ -98,7 +98,7 @@ void Part::newTab()
Session* Part::activeSession() const
{
if (_viewManager->activeViewController()) {
if (_viewManager->activeViewController() != nullptr) {
Q_ASSERT(_viewManager->activeViewController()->session());
return _viewManager->activeViewController()->session();
......@@ -215,7 +215,7 @@ void Part::activeViewChanged(SessionController* controller)
Q_ASSERT(controller->view());
// remove existing controller
if (_pluggedController) {
if (_pluggedController != nullptr) {
removeChildClient(_pluggedController);
disconnect(_pluggedController, &Konsole::SessionController::titleChanged, this,
&Konsole::Part::activeViewTitleChanged);
......
......@@ -279,7 +279,7 @@ bool ProcessInfo::userNameRequired() const
QString ProcessInfo::currentDir(bool* ok) const
{
if (ok)
if (ok != nullptr)
*ok = (_fields & CURRENT_DIR) != 0;
return _currentDir;
......
......@@ -83,7 +83,7 @@ QAction* ProfileList::actionForProfile(Profile::Ptr profile) const
void ProfileList::profileChanged(Profile::Ptr profile)
{
QAction* action = actionForProfile(profile);
if (action)
if (action != nullptr)
updateAction(action, profile);
}
......@@ -102,7 +102,7 @@ void ProfileList::shortcutChanged(Profile::Ptr profile, const QKeySequence& sequ
QAction* action = actionForProfile(profile);
if (action) {
if (action != nullptr) {
action->setShortcut(sequence);
}
}
......@@ -143,7 +143,7 @@ void ProfileList::favoriteChanged(Profile::Ptr profile, bool isFavorite)
} else {
QAction* action = actionForProfile(profile);
if (action) {
if (action != nullptr) {
_group->removeAction(action);
foreach(QWidget * widget, _registeredWidgets) {
widget->removeAction(action);
......
......@@ -659,7 +659,7 @@ void Screen::displayCharacter(unsigned short c)
ushort extendedCharLength;
const ushort* oldChars = ExtendedCharTable::instance.lookupExtendedChar(currentChar.character, extendedCharLength);
Q_ASSERT(oldChars);
if ((oldChars) && extendedCharLength < 3) {
if (((oldChars) != nullptr) && extendedCharLength < 3) {
Q_ASSERT(extendedCharLength > 1);
Q_ASSERT(extendedCharLength < 65535);
auto chars = new ushort[extendedCharLength + 1];
......
......@@ -193,7 +193,7 @@ void Session::setDarkBackground(bool darkBackground)
bool Session::isRunning() const
{
return _shellProcess && (_shellProcess->state() == QProcess::Running);
return (_shellProcess != nullptr) && (_shellProcess->state() == QProcess::Running);
}
void Session::setCodec(QTextCodec* codec)
......@@ -205,7 +205,7 @@ bool Session::setCodec(const QByteArray& name)
{
QTextCodec* codec = QTextCodec::codecForName(name);
if (codec) {
if (codec != nullptr) {
setCodec(codec);
return true;
} else {
......@@ -975,7 +975,7 @@ void Session::updateSessionProcessInfo()
// The checking for pid changing looks stupid, but it is needed
// at the moment to workaround the problem that processId() might
// return 0
if (!_sessionProcessInfo ||
if ((_sessionProcessInfo == nullptr) ||
(processId() != 0 && processId() != _sessionProcessInfo->pid(&ok))) {
delete _sessionProcessInfo;
_sessionProcessInfo = ProcessInfo::newInstance(processId(),
......@@ -997,7 +997,7 @@ bool Session::updateForegroundProcessInfo()
_foregroundPid = foregroundPid;
}
if (_foregroundProcessInfo) {
if (_foregroundProcessInfo != nullptr) {
_foregroundProcessInfo->update();
return _foregroundProcessInfo->isValid();
} else {
......@@ -1228,14 +1228,14 @@ void Session::setFlowControlEnabled(bool enabled)
{
_flowControlEnabled = enabled;
if (_shellProcess)
if (_shellProcess != nullptr)
_shellProcess->setFlowControlEnabled(_flowControlEnabled);
emit flowControlEnabledChanged(enabled);
}
bool Session::flowControlEnabled() const
{
if (_shellProcess)
if (_shellProcess != nullptr)
return _shellProcess->flowControlEnabled();
else
return _flowControlEnabled;
......@@ -1329,7 +1329,7 @@ void Session::zmodemFinished()
ZModemDialog's user1Clicked(). Therefore, an invocation by
user1Clicked() will recursively invoke this function again
when the KProcess is deleted! */
if (_zmodemProc) {
if (_zmodemProc != nullptr) {
KProcess* process = _zmodemProc;
_zmodemProc = 0; // Set _zmodemProc to 0 avoid recursive invocations!
_zmodemBusy = false;
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ void PlainTextDecoder::decodeLine(const Character* const characters, int count,
{
Q_ASSERT(_output);
if (_recordLinePositions && _output->string()) {
if (_recordLinePositions && (_output->string() != nullptr)) {
int pos = _output->string()->count();
_linePositions << pos;
}
......@@ -111,7 +111,7 @@ void PlainTextDecoder::decodeLine(const Character* const characters, int count,
if ((characters[i].rendition & RE_EXTENDED_CHAR) != 0) {
ushort extendedCharLength = 0;
const ushort* chars = ExtendedCharTable::instance.lookupExtendedChar(characters[i].character, extendedCharLength);
if (chars) {
if (chars != nullptr) {
const QString s = QString::fromUtf16(chars, extendedCharLength);
plainText.append(s);
i += qMax(1, string_width(s));
......@@ -198,7 +198,7 @@ void HTMLDecoder::decodeLine(const Character* const characters, int count, LineP
QString style;
//colors - a color table must have been defined first
if (_colorTable) {
if (_colorTable != nullptr) {
bool useBold = (_lastRendition & RE_BOLD) != 0;
if (useBold)
style.append("font-weight:bold;");
......@@ -227,7 +227,7 @@ void HTMLDecoder::decodeLine(const Character* const characters, int count, LineP
if ((characters[i].rendition & RE_EXTENDED_CHAR) != 0) {
ushort extendedCharLength = 0;
const ushort* chars = ExtendedCharTable::instance.lookupExtendedChar(characters[i].character, extendedCharLength);
if (chars) {
if (chars != nullptr) {
text.append(QString::fromUtf16(chars, extendedCharLength));
}
} else {
......
This diff is collapsed.
......@@ -45,7 +45,7 @@ int TerminalDisplayAccessible::characterCount() const
int TerminalDisplayAccessible::cursorPosition() const
{
if (!display()->screenWindow())
if (display()->screenWindow() == nullptr)
return 0;
int offset = display()->_usedColumns * display()->screenWindow()->screen()->getCursorY();
......@@ -56,7 +56,7 @@ void TerminalDisplayAccessible::selection(int selectionIndex, int* startOffset,
{
*startOffset = 0;
*endOffset = 0;
if (!display()->screenWindow() || selectionIndex)
if ((display()->screenWindow() == nullptr) || (selectionIndex != 0))
return;
int startLine;
......@@ -73,7 +73,7 @@ void TerminalDisplayAccessible::selection(int selectionIndex, int* startOffset,
int TerminalDisplayAccessible::selectionCount() const
{
if (!display()->screenWindow())
if (display()->screenWindow() == nullptr)
return 0;
int startLine;
......@@ -89,7 +89,7 @@ QString TerminalDisplayAccessible::visibleText() const