1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fixes segfault on opening incompatible files.

If a file cannot be opened by the plugin connected, the engine
would crash. This has been fixed by quitting the open_file() method
early.
This commit is contained in:
Anish
2019-03-11 16:37:22 +05:30
parent 91d3ea0d1f
commit bd22b1cbe6

View File

@@ -117,6 +117,7 @@ bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
file = FileAccess::open(p_file, FileAccess::READ); file = FileAccess::open(p_file, FileAccess::READ);
bool file_opened = interface->open_file(data_struct, file); bool file_opened = interface->open_file(data_struct, file);
if (file_opened) {
num_channels = interface->get_channels(data_struct); num_channels = interface->get_channels(data_struct);
mix_rate = interface->get_mix_rate(data_struct); mix_rate = interface->get_mix_rate(data_struct);
@@ -129,6 +130,7 @@ bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
samples_decoded = 0; samples_decoded = 0;
texture->create((int)texture_size.width, (int)texture_size.height, Image::FORMAT_RGBA8, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE); texture->create((int)texture_size.width, (int)texture_size.height, Image::FORMAT_RGBA8, Texture::FLAG_FILTER | Texture::FLAG_VIDEO_SURFACE);
}
return file_opened; return file_opened;
} }