Fix #145853: Crash using Blade or Slip tool in VSE with new scene

If adding a scene from the main window header, it is possible to have a
defined `sequencer_scene` but an undefined `ed`.

Add check for non-null `ed` and move all the checks up to the start of
`sequencer_main_cursor`.

Pull Request: https://projects.blender.org/blender/blender/pulls/145854
This commit is contained in:
John Kiril Swenson
2025-09-07 23:18:31 +02:00
committed by John Kiril Swenson
parent 10027d9a6d
commit 75bca47553

View File

@@ -673,10 +673,14 @@ static bool is_mouse_over_retiming_key(const Scene *scene,
static void sequencer_main_cursor(wmWindow *win, ScrArea *area, ARegion *region)
{
const WorkSpace *workspace = WM_window_get_active_workspace(win);
const Scene *scene = workspace->sequencer_scene;
const Editing *ed = seq::editing_get(scene);
const bToolRef *tref = area->runtime.tool;
int wmcursor = WM_CURSOR_DEFAULT;
const bToolRef *tref = area->runtime.tool;
if (tref == nullptr) {
if (tref == nullptr || scene == nullptr || ed == nullptr) {
WM_cursor_set(win, wmcursor);
return;
}
@@ -700,14 +704,6 @@ static void sequencer_main_cursor(wmWindow *win, ScrArea *area, ARegion *region)
UI_view2d_region_to_view(
&region->v2d, mouse_co_region[0], mouse_co_region[1], &mouse_co_view[0], &mouse_co_view[1]);
const WorkSpace *workspace = WM_window_get_active_workspace(win);
const Scene *scene = workspace->sequencer_scene;
if (!scene) {
WM_cursor_set(win, wmcursor);
return;
}
const Editing *ed = seq::editing_get(scene);
if (STREQ(tref->idname, "builtin.blade") || STREQ(tref->idname, "builtin.slip")) {
int mval[2] = {int(mouse_co_region[0]), int(mouse_co_region[1])};
Strip *strip = strip_under_mouse_get(scene, v2d, mval);