diff options
author | Tuchila Octavian <octaviant@google.com> | 2022-02-08 11:35:00 +0000 |
---|---|---|
committer | Octavian Tuchila <octaviant@google.com> | 2022-02-08 11:41:44 +0000 |
commit | e83e8c2c09e33087a94bb4a4c96224cafd0d9e65 (patch) | |
tree | 8572dec12ac01b5393ce4aa9a7e3f4fb450b8e8d | |
parent | 605bd3a3ad96c56f98780e7b4b6b247e1d9e0ae9 (diff) | |
download | perfetto-e83e8c2c09e33087a94bb4a4c96224cafd0d9e65.tar.gz |
ui: Update ArgTree type check
When there is an argument with a 'length' field, the logic
incorrectly assumes it is an ArgTreeArray instead of an ArgTreeMap.
This leads to crash here:
http://shortn/_aUD7nsSK71
https://screenshot.googleplex.com/AY52WpejUPfwXdE
This solution changes the type check.
An alternative solution would have been to create `type` fields in
both `ArgTreeMap` and `ArgTreeArray` and then check on those.
Bug: 218298947
Change-Id: I0fe662811dd1539ed344c5bed0c0d642a42f2baf
-rw-r--r-- | ui/src/common/arg_types.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ui/src/common/arg_types.ts b/ui/src/common/arg_types.ts index 6ca6a049a..864dc4b2b 100644 --- a/ui/src/common/arg_types.ts +++ b/ui/src/common/arg_types.ts @@ -22,9 +22,9 @@ export interface ArgsTreeMap { } export function isArgTreeArray(item: ArgsTree): item is ArgsTreeArray { - return typeof item === 'object' && item.length !== undefined; + return typeof item === 'object' && Array.isArray(item); } export function isArgTreeMap(item: ArgsTree): item is ArgsTreeMap { - return typeof item === 'object' && item.length === undefined; + return typeof item === 'object' && !Array.isArray(item); } |