Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ class _CpuProfileTimelineTree {
if (isCodeTree) {
return _code.function!;
}
final function = samples.functions![index].function;
final function = samples.functions?[index].function;
if (function is vm_service.FuncRef ||
function is vm_service.NativeFunction) {
return function;
Expand Down Expand Up @@ -1263,7 +1263,7 @@ class _CpuProfileTimelineTree {
// critical since this is only displayed when VM developer mode is
// enabled.
(_function as vm_service.FuncRef?)?.location?.script?.uri
: samples.functions![index].resolvedUrl;
: samples.functions?[index].resolvedUrl;

int? get sourceLine {
final function = _function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ void main() {
);
});

test('converts samples with no functions regression test', () {
expect(
// False positive for this lint, it is used by the matcher.
// ignore: discarded_futures
CpuProfileData.generateFromCpuSamples(
isolateId: goldenSamplesIsolate,
cpuSamples: CpuSamples.parse(goldenCpuSamplesJson)!..functions = null,
),
completes,
);
});

test('to json defaults packageUri to resolvedUrl', () {
const id = '140357727781376-12';

Expand Down