# HG changeset patch # User Teemu Piippo # Date 1522830167 -10800 # Node ID 86e5a2259f58ea509d91ff5c2e5e033e11905a48 # Parent 0b9a946002be75a70f3ff59cbebfb1a37e0303e6 refactor diff -r 0b9a946002be -r 86e5a2259f58 src/mainwindow.cpp --- a/src/mainwindow.cpp Wed Apr 04 11:19:49 2018 +0300 +++ b/src/mainwindow.cpp Wed Apr 04 11:22:47 2018 +0300 @@ -896,21 +896,23 @@ } } -// --------------------------------------------------------------------------------------------------------------------- -// +/* + * Returns the currently open document. + */ LDDocument* MainWindow::currentDocument() { return m_currentDocument; } -// --------------------------------------------------------------------------------------------------------------------- -// -// TODO: document may be null, this shouldn't be the case -// -void MainWindow::changeDocument (LDDocument* document) +/* + * Changes the current document to the specified document. + */ +void MainWindow::changeDocument(LDDocument* document) { + Q_ASSERT(document != nullptr); + // Implicit files were loaded for caching purposes and may never be switched to. - if (document and document->isFrozen()) + if (document->isFrozen()) return; m_currentDocument = document;