66
77#include < variant>
88
9+ #include " flutter/fml/logging.h"
910#include " flutter/fml/platform/win/wstring_conversion.h"
1011#include " flutter/shell/platform/common/client_wrapper/include/flutter/standard_message_codec.h"
1112#include " flutter/shell/platform/windows/flutter_windows_engine.h"
@@ -26,16 +27,27 @@ static constexpr char kAnnounceValue[] = "announce";
2627void HandleMessage (AccessibilityPlugin* plugin, const EncodableValue& message) {
2728 const auto * map = std::get_if<EncodableMap>(&message);
2829 if (!map) {
30+ FML_LOG (ERROR) << " Accessibility message must be a map." ;
2931 return ;
3032 }
3133 const auto & type_itr = map->find (EncodableValue{kTypeKey });
3234 const auto & data_itr = map->find (EncodableValue{kDataKey });
33- if (type_itr == map->end () || data_itr == map->end ()) {
35+ if (type_itr == map->end ()) {
36+ FML_LOG (ERROR) << " Accessibility message must have a 'type' property." ;
37+ return ;
38+ }
39+ if (data_itr == map->end ()) {
40+ FML_LOG (ERROR) << " Accessibility message must have a 'data' property." ;
3441 return ;
3542 }
3643 const auto * type = std::get_if<std::string>(&type_itr->second );
3744 const auto * data = std::get_if<EncodableMap>(&data_itr->second );
38- if (!type || !data) {
45+ if (!type) {
46+ FML_LOG (ERROR) << " Accessibility message 'type' property must be a string." ;
47+ return ;
48+ }
49+ if (!data) {
50+ FML_LOG (ERROR) << " Accessibility message 'data' property must be a map." ;
3951 return ;
4052 }
4153
@@ -50,6 +62,9 @@ void HandleMessage(AccessibilityPlugin* plugin, const EncodableValue& message) {
5062 }
5163
5264 plugin->Announce (*message);
65+ } else {
66+ FML_LOG (ERROR) << " Accessibility message type '" << *type
67+ << " ' is not supported." ;
5368 }
5469}
5570
0 commit comments