From a2022a07a24c6c87d7cb42917976e7c4fff74230 Mon Sep 17 00:00:00 2001 From: Jamie Wong Date: Sun, 17 Feb 2019 18:30:02 -0800 Subject: [PATCH] Fix crash when importing from stackprof without raw_timestamp_deltas (#207) Fixes #200 --- src/import/index.test.ts | 4 ++++ src/import/index.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/import/index.test.ts b/src/import/index.test.ts index 0368143..04c3488 100644 --- a/src/import/index.test.ts +++ b/src/import/index.test.ts @@ -5,4 +5,8 @@ test('importProfileGroup', async () => { expect(await importProfileGroupFromText('unknown', '')).toBe(null) expect(await importProfileGroupFromText('unknown', 'Hello world')).toBe(null) expect(await importProfileGroupFromText('unknown', 'Hello\n\nWorld')).toBe(null) + + // Importing from a version of stackprof which was missing raw_timestamp_deltas should return null + const oldStackprof = `{"version":1.2,"mode":"wall","interval":1000,"samples":0,"gc_samples":0,"missed_samples":0,"frames":{}}` + expect(await importProfileGroupFromText('unknown', oldStackprof)).toBe(null) }) diff --git a/src/import/index.ts b/src/import/index.ts index 77aadff..04e50b8 100644 --- a/src/import/index.ts +++ b/src/import/index.ts @@ -137,7 +137,7 @@ async function _importProfileGroup(dataSource: ProfileDataSource): Promise