Fix a bug when calling Editor::editor_set_sprite(NULL).

The editor_clean_cursor() function is called from
editor_set_scroll() when no sprite is selected.
This commit is contained in:
David Capello 2010-11-01 21:07:56 -03:00
parent 24c2bf40e3
commit b59b14444e
2 changed files with 6 additions and 0 deletions

View File

@ -341,6 +341,8 @@ void Editor::editor_draw_cursor(int x, int y, bool refresh)
void Editor::editor_move_cursor(int x, int y, bool refresh)
{
ASSERT(m_sprite != NULL);
int old_screen_x = m_cursor_screen_x;
int old_screen_y = m_cursor_screen_y;
int old_x = m_cursor_editor_x;
@ -399,6 +401,7 @@ void Editor::editor_clean_cursor(bool refresh)
int x, y;
ASSERT(m_cursor_thick != 0);
ASSERT(m_sprite != NULL);
clipping_region = jwidget_get_drawable_region(this, JI_GDR_CUTTOPWINDOWS);

View File

@ -141,6 +141,9 @@ void Editor::editor_set_sprite(Sprite* sprite)
ASSERT(m_pixelsMovement == NULL && "You cannot change the current sprite while you are moving pixels");
ASSERT(m_state == EDITOR_STATE_STANDBY && "You can change the current sprite only in stand-by state");
if (m_cursor_thick)
editor_clean_cursor();
// Change the sprite
m_sprite = sprite;
if (m_sprite) {