mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Fix Timeline::updateUsingEditor() as it can be called with editor=NULL
In fact, now it's called with NULL when the program starts (see commit 517d368f938ca55f915ce9e8ffb57d96b5288b1d).
This commit is contained in:
parent
6f50385d5f
commit
a1f3e290c2
@ -127,18 +127,20 @@ Timeline::~Timeline()
|
||||
|
||||
void Timeline::updateUsingEditor(Editor* editor)
|
||||
{
|
||||
DocumentView* view = editor->getDocumentView();
|
||||
DocumentLocation location;
|
||||
view->getDocumentLocation(&location);
|
||||
|
||||
if (m_editor)
|
||||
m_editor->removeObserver(this);
|
||||
detachDocument();
|
||||
|
||||
// We always update the editor. In this way the timeline keeps in
|
||||
// sync with the active editor.
|
||||
m_editor = editor;
|
||||
|
||||
if (m_editor)
|
||||
m_editor->addObserver(this);
|
||||
else
|
||||
return; // No editor specified.
|
||||
|
||||
DocumentLocation location;
|
||||
DocumentView* view = m_editor->getDocumentView();
|
||||
view->getDocumentLocation(&location);
|
||||
|
||||
// If we are already in the same position as the "editor", we don't
|
||||
// need to update the at all timeline.
|
||||
@ -148,8 +150,6 @@ void Timeline::updateUsingEditor(Editor* editor)
|
||||
m_frame == location.frame())
|
||||
return;
|
||||
|
||||
detachDocument();
|
||||
|
||||
m_document = location.document();
|
||||
m_sprite = location.sprite();
|
||||
m_layer = location.layer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user