Fix EditorNode::drag_resource crash.

This commit is contained in:
Pāvels Nadtočajevs
2025-05-10 20:49:19 +03:00
parent 19bb18716e
commit 44400b1419

View File

@ -6035,11 +6035,13 @@ Dictionary EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from
{
// TODO: make proper previews
Ref<ImageTexture> texture = theme->get_icon(SNAME("FileBigThumb"), EditorStringName(EditorIcons));
Ref<Image> img = texture->get_image();
img = img->duplicate();
img->resize(48, 48); // meh
preview = ImageTexture::create_from_image(img);
Ref<Texture2D> texture = theme->get_icon(SNAME("FileBigThumb"), EditorStringName(EditorIcons));
if (texture.is_valid()) {
Ref<Image> img = texture->get_image();
img = img->duplicate();
img->resize(48, 48); // meh
preview = ImageTexture::create_from_image(img);
}
}
drag_preview->set_texture(preview);