diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 4d5754ac9703..4d30a88e0d9a 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -291,6 +291,8 @@ v8::Local NativeImage::ToBitmap(mate::Arguments* args) { v8::Local NativeImage::ToJPEG(v8::Isolate* isolate, int quality) { std::vector output; gfx::JPEG1xEncodedDataFromImage(image_, quality, &output); + if (output.empty()) + return node::Buffer::New(isolate, 0).ToLocalChecked(); return node::Buffer::Copy( isolate, reinterpret_cast(&output.front()),