diff --git a/src/base/bitmap.c b/src/base/bitmap.c index a4be64ec0..77258fda6 100644 --- a/src/base/bitmap.c +++ b/src/base/bitmap.c @@ -131,7 +131,8 @@ static ret_t bitmap_platform_create(bitmap_t* bitmap) { bitmap_format_t format = bitmap->format; uint8_t* data = bitmap_lock_buffer_for_write(bitmap); - return_value_if_fail(format == BITMAP_FMT_RGBA8888, NULL); + return_value_if_fail(format == BITMAP_FMT_RGBA8888, RET_BAD_PARAMS); + int32_t id = EM_ASM_INT( { return VGCanvas.createMutableImage($0, $1, $2, $3, $4); }, data, w, h, line_length, format); bitmap->specific = tk_pointer_from_int(id); @@ -607,7 +608,7 @@ ret_t bitmap_init_ex(bitmap_t* bitmap, uint32_t w, uint32_t h, uint32_t line_len bitmap->should_free_data = TRUE; } - if (bitmap->buffer == NULL) { + if (bitmap->buffer != NULL) { bitmap_platform_create(bitmap); }