fix codecheck

Signed-off-by: HengmingWang <wanghengming@huawei.com>
This commit is contained in:
HengmingWang 2024-05-21 20:15:34 +08:00
parent a89640bc4d
commit d71eca66b6
7 changed files with 35 additions and 0 deletions

View File

@ -71,6 +71,11 @@ napi_value JsBrush::Constructor(napi_env env, napi_callback_info info)
}
JsBrush* jsBrush = new(std::nothrow) JsBrush();
if (!jsBrush) {
ROSEN_LOGE("JsBrush::Constructor Failed to create JsBrush");
return nullptr;
}
status = napi_wrap(env, jsThis, jsBrush,
JsBrush::Destructor, nullptr, nullptr);
if (status != napi_ok) {

View File

@ -276,6 +276,10 @@ napi_value JsCanvas::Constructor(napi_env env, napi_callback_info info)
return nullptr;
}
JsCanvas *jsCanvas = new(std::nothrow) JsCanvas(g_drawingCanvas);
if (!jsCanvas) {
ROSEN_LOGE("Drawing_napi: Failed to create JsCanvas");
return nullptr;
}
status = napi_wrap(env, jsThis, jsCanvas, JsCanvas::Destructor, nullptr, nullptr);
if (status != napi_ok) {
delete jsCanvas;
@ -299,6 +303,10 @@ napi_value JsCanvas::Constructor(napi_env env, napi_callback_info info)
Canvas* canvas = new Canvas();
canvas->Bind(bitmap);
JsCanvas *jsCanvas = new(std::nothrow) JsCanvas(canvas, true);
if (!jsCanvas) {
ROSEN_LOGE("Drawing_napi: Failed to create JsCanvas");
return nullptr;
}
status = napi_wrap(env, jsThis, jsCanvas, JsCanvas::Destructor, nullptr, nullptr);
if (status != napi_ok) {
delete jsCanvas;

View File

@ -83,6 +83,11 @@ napi_value JsColorFilter::Constructor(napi_env env, napi_callback_info info)
}
JsColorFilter *jsColorFilter = new(std::nothrow) JsColorFilter();
if (!jsColorFilter) {
ROSEN_LOGE("Failed to create JsColorFilter");
return nullptr;
}
status = napi_wrap(env, jsThis, jsColorFilter, JsColorFilter::Destructor, nullptr, nullptr);
if (status != napi_ok) {
delete jsColorFilter;

View File

@ -64,6 +64,10 @@ napi_value JsTypeface::Constructor(napi_env env, napi_callback_info info)
}
JsTypeface *jsTypeface = new(std::nothrow) JsTypeface(JsTypeface::LoadZhCnTypeface());
if (!jsTypeface) {
ROSEN_LOGE("Failed to create JsTypeface");
return nullptr;
}
status = napi_wrap(env, jsThis, jsTypeface, JsTypeface::Destructor, nullptr, nullptr);
if (status != napi_ok) {

View File

@ -70,6 +70,10 @@ napi_value JsPath::Constructor(napi_env env, napi_callback_info info)
Path *path = new Path();
JsPath *jsPath = new(std::nothrow) JsPath(path);
if (!jsPath) {
ROSEN_LOGE("Failed to create JsPath");
return nullptr;
}
status = napi_wrap(env, jsThis, jsPath,
JsPath::Destructor, nullptr, nullptr);

View File

@ -80,6 +80,11 @@ napi_value JsPen::Constructor(napi_env env, napi_callback_info info)
}
JsPen* jsPen = new(std::nothrow) JsPen();
if (!jsPen) {
ROSEN_LOGE("JsPen::Constructor Failed to create JsPen");
return nullptr;
}
status = napi_wrap(env, jsThis, jsPen,
JsPen::Destructor, nullptr, nullptr);
if (status != napi_ok) {

View File

@ -79,6 +79,10 @@ napi_value JsTextBlob::Constructor(napi_env env, napi_callback_info info)
}
JsTextBlob *jsTextBlob = new(std::nothrow) JsTextBlob(env, drawingTextBlob);
if (!jsTextBlob) {
ROSEN_LOGE("Failed to create JsTextBlob");
return nullptr;
}
status = napi_wrap(env, jsThis, jsTextBlob,
JsTextBlob::Destructor, nullptr, nullptr);