Skip to content

Commit e1a1dfa

Browse files
committed
fix winToast crash on windows7
1 parent 6511d44 commit e1a1dfa

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

packages/win_toast/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.2 21/11/19
2+
3+
* fix cause crash on Windows 7.
4+
15
## 0.0.1 21/9/27
26

37
* add basic functions.

packages/win_toast/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: win_toast
22
description: a plugin help flutter app show toast on windows platform.
3-
version: 0.0.1
3+
version: 0.0.2
44
homepage: https://github.com/MixinNetwork/flutter-plugins/tree/main/packages/win_toast
55

66
environment:

packages/win_toast/windows/win_toast_plugin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Toast {
3939
if (image.size() != 0) {
4040
toastTemplate_.setImagePath(string2wString(image));
4141
}
42-
for (auto action : actions) {
42+
for (auto action: actions) {
4343
toastTemplate_.addAction(string2wString(action));
4444
}
4545
}
@@ -170,6 +170,7 @@ void WinToastPlugin::HandleMethodCall(
170170
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
171171
if (!WinToast::isCompatible()) {
172172
result->Error("1", "Error, your system in not supported!");
173+
return;
173174
}
174175
if (method_call.method_name().compare("initialize") == 0) {
175176
auto *arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
@@ -189,7 +190,7 @@ void WinToastPlugin::HandleMethodCall(
189190
auto type = std::get<int>(arguments->at(flutter::EncodableValue("type")));
190191
auto actions = std::get<flutter::EncodableList>(arguments->at(flutter::EncodableValue("actions")));
191192
std::vector<std::string> action_strs;
192-
for (auto const &action : actions) {
193+
for (auto const &action: actions) {
193194
action_strs.push_back(std::get<std::string>(action));
194195
}
195196
auto toast = std::make_shared<Toast>(type, title, subtitle, imagePath, std::move(action_strs));

0 commit comments

Comments
 (0)