Skip to content

Commit 095a376

Browse files
authored
[desktop_drop] fix windows build warning C4701: potentially uninitialized local variable 'hwnd' (#279)
1 parent 1f24027 commit 095a376

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/desktop_drop/windows/desktop_drop_plugin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,16 @@ namespace {
138138
registrar->messenger(), "desktop_drop",
139139
&flutter::StandardMethodCodec::GetInstance());
140140

141-
HWND hwnd;
141+
HWND hwnd = nullptr;
142142
if (registrar->GetView()) {
143143
hwnd = registrar->GetView()->GetNativeWindow();
144144
}
145145

146+
if (hwnd == nullptr) {
147+
// no window, no drop.
148+
return;
149+
}
150+
146151
channel->SetMethodCallHandler([](const auto &call, auto result) {
147152
result->NotImplemented();
148153
});

0 commit comments

Comments
 (0)