Fix the FlipperArray creation of events

Summary:
The FlipperArray creation from JSONArray used to create an array of `null`'s instead of the FlipperObject, which used to crash the Flipper. Thus added a check in the flipper to not crash in the case when it receives array of nulls. Also fixed the Fresco plugin in mobile to send the proper FlipperArray.

Bug:

{F160049909}

Reviewed By: passy

Differential Revision: D15608297

fbshipit-source-id: 625e017d3bce4135ac699ee5aee8d871db378749
This commit is contained in:
Pritesh Nandgaonkar
2019-06-04 03:35:14 -07:00
committed by Facebook Github Bot
parent 95fae7d4e8
commit 62c112c713
2 changed files with 19 additions and 4 deletions

View File

@@ -105,8 +105,15 @@ export default class extends FlipperPlugin<PluginState, *, PersistedState> {
};
events.forEach((event: ImageEventWithId, index) => {
if (!event) {
return;
}
const {attribution} = event;
if (attribution instanceof Array && attribution.length > 0) {
if (
attribution &&
attribution instanceof Array &&
attribution.length > 0
) {
const surface = attribution[0].trim();
if (surface.length > 0) {
pluginData.surfaceList.add(surface);