Commit 153688e1 authored by Ömer Fadıl Usta's avatar Ömer Fadıl Usta 😊

Fix calling methods on null objects

Some object methods were calling without checking if the object
exist or not.
parent f049619c
Pipeline #34552 passed with stage
in 59 minutes and 12 seconds
...@@ -2012,26 +2012,27 @@ void MainWindow::slotRenderProject() ...@@ -2012,26 +2012,27 @@ void MainWindow::slotRenderProject()
{ {
KdenliveDoc *project = pCore->currentDoc(); KdenliveDoc *project = pCore->currentDoc();
if (!m_renderWidget) { if ( !m_renderWidget && project ) {
if (project) { m_renderWidget = new RenderWidget(project->useProxy(), this);
m_renderWidget = new RenderWidget(project->useProxy(), this); connect(m_renderWidget, &RenderWidget::shutdown, this, &MainWindow::slotShutdown);
connect(m_renderWidget, &RenderWidget::shutdown, this, &MainWindow::slotShutdown); connect(m_renderWidget, &RenderWidget::selectedRenderProfile, this, &MainWindow::slotSetDocumentRenderProfile);
connect(m_renderWidget, &RenderWidget::selectedRenderProfile, this, &MainWindow::slotSetDocumentRenderProfile); connect(m_renderWidget, &RenderWidget::abortProcess, this, &MainWindow::abortRenderJob);
connect(m_renderWidget, &RenderWidget::abortProcess, this, &MainWindow::abortRenderJob); connect(m_renderWidget, &RenderWidget::openDvdWizard, this, &MainWindow::slotDvdWizard);
connect(m_renderWidget, &RenderWidget::openDvdWizard, this, &MainWindow::slotDvdWizard); connect(this, &MainWindow::updateRenderWidgetProfile, m_renderWidget, &RenderWidget::adjustViewToProfile);
connect(this, &MainWindow::updateRenderWidgetProfile, m_renderWidget, &RenderWidget::adjustViewToProfile); m_renderWidget->setGuides(project->getGuideModel());
m_renderWidget->setGuides(project->getGuideModel()); m_renderWidget->updateDocumentPath();
m_renderWidget->updateDocumentPath(); m_renderWidget->setRenderProfile(project->getRenderProperties());
m_renderWidget->setRenderProfile(project->getRenderProperties()); }
} if ( m_renderWidget && m_compositeAction && m_compositeAction->currentAction() ) {
if (m_compositeAction->currentAction()) { m_renderWidget->errorMessage(RenderWidget::CompositeError, m_compositeAction->currentAction()->data().toInt() == 1
m_renderWidget->errorMessage(RenderWidget::CompositeError, m_compositeAction->currentAction()->data().toInt() == 1 ? i18n("Rendering using low quality track compositing")
? i18n("Rendering using low quality track compositing") : QString());
: QString());
}
} }
slotCheckRenderStatus(); slotCheckRenderStatus();
m_renderWidget->show(); if ( m_renderWidget ) {
m_renderWidget->show();
}
// m_renderWidget->showNormal(); // m_renderWidget->showNormal();
// What are the following lines supposed to do? // What are the following lines supposed to do?
......
...@@ -1624,8 +1624,10 @@ bool TimelineController::createSplitOverlay(int clipId, std::shared_ptr<Mlt::Fil ...@@ -1624,8 +1624,10 @@ bool TimelineController::createSplitOverlay(int clipId, std::shared_ptr<Mlt::Fil
if (!m_timelinePreview) { if (!m_timelinePreview) {
initializePreview(); initializePreview();
} }
m_timelinePreview->setOverlayTrack(overlay); if(m_timelinePreview){
m_model->m_overlayTrackCount = m_timelinePreview->addedTracks(); m_timelinePreview->setOverlayTrack(overlay);
m_model->m_overlayTrackCount = m_timelinePreview->addedTracks();
}
return true; return true;
} }
...@@ -1808,15 +1810,20 @@ void TimelineController::loadPreview(const QString &chunks, const QString &dirty ...@@ -1808,15 +1810,20 @@ void TimelineController::loadPreview(const QString &chunks, const QString &dirty
for (const QString &frame : qAsConst(dirtyList)) { for (const QString &frame : qAsConst(dirtyList)) {
dirtyChunks << frame.toInt(); dirtyChunks << frame.toInt();
} }
m_disablePreview->blockSignals(true);
m_disablePreview->setChecked(enable); if ( m_disablePreview ) {
m_disablePreview->blockSignals(false); m_disablePreview->blockSignals(true);
if (!enable) { m_disablePreview->setChecked(enable);
m_timelinePreview->buildPreviewTrack(); m_disablePreview->blockSignals(false);
m_usePreview = true; }
m_model->m_overlayTrackCount = m_timelinePreview->addedTracks(); if ( m_timelinePreview ) {
if (!enable) {
m_timelinePreview->buildPreviewTrack();
m_usePreview = true;
m_model->m_overlayTrackCount = m_timelinePreview->addedTracks();
}
m_timelinePreview->loadChunks(renderedChunks, dirtyChunks, documentDate);
} }
m_timelinePreview->loadChunks(renderedChunks, dirtyChunks, documentDate);
} }
QMap<QString, QString> TimelineController::documentProperties() QMap<QString, QString> TimelineController::documentProperties()
......
...@@ -627,7 +627,7 @@ void GraphicsSceneRectMove::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) ...@@ -627,7 +627,7 @@ void GraphicsSceneRectMove::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
if (m_tool == TITLE_RECTANGLE && (m_selectedItem != nullptr)) { if (m_tool == TITLE_RECTANGLE && (m_selectedItem != nullptr)) {
setSelectedItem(m_selectedItem); setSelectedItem(m_selectedItem);
} }
if (m_createdText) { if (m_createdText && m_selectedItem) {
m_selectedItem->setSelected(true); m_selectedItem->setSelected(true);
auto *newText = static_cast<MyTextItem *>(m_selectedItem); auto *newText = static_cast<MyTextItem *>(m_selectedItem);
QTextCursor cur(newText->document()); QTextCursor cur(newText->document());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment