Skip to content

Commit 7a6dd58

Browse files
authored
Fix a platform view bug (#33)
* If creating a platform view instance fails, the engine has to send an error to flutter through method channel
1 parent 677661c commit 7a6dd58

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

shell/platform/tizen/channels/platform_view_channel.cc

+12-9
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,19 @@ void PlatformViewChannel::HandleMethodCall(
147147

148148
auto viewInstance =
149149
it->second->Create(viewId, width, height, byteMessage);
150-
view_instances_.insert(
151-
std::pair<int, PlatformView*>(viewId, viewInstance));
152-
153-
if (engine_ && engine_->text_input_channel) {
154-
Ecore_IMF_Context* context =
155-
engine_->text_input_channel->GetImfContext();
156-
viewInstance->SetSoftwareKeyboardContext(context);
150+
if (viewInstance) {
151+
view_instances_.insert(
152+
std::pair<int, PlatformView*>(viewId, viewInstance));
153+
154+
if (engine_ && engine_->text_input_channel) {
155+
Ecore_IMF_Context* context =
156+
engine_->text_input_channel->GetImfContext();
157+
viewInstance->SetSoftwareKeyboardContext(context);
158+
}
159+
result->Success(flutter::EncodableValue(viewInstance->GetTextureId()));
160+
} else {
161+
result->Error("Can't create a webview instance!!");
157162
}
158-
159-
result->Success(flutter::EncodableValue(viewInstance->GetTextureId()));
160163
} else {
161164
FT_LOGE("can't find view type = %s", viewType.c_str());
162165
result->Error("Can't find view type");

0 commit comments

Comments
 (0)