Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 54da219

Browse files
committed
Fix null access crash
1 parent 77bf1cb commit 54da219

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

impeller/compiler/switches.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ std::vector<TargetPlatform> Switches::PlatformsToCompile() const {
297297
}
298298

299299
TargetPlatform Switches::SelectDefaultTargetPlatform() const {
300-
if (target_platform_ == TargetPlatform::kUnknown) {
300+
if (target_platform_ == TargetPlatform::kUnknown &&
301+
!runtime_stages_.empty()) {
301302
return runtime_stages_.front();
302303
}
303304
return target_platform_;

impeller/compiler/switches.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Switches {
6767
// Use |SelectDefaultTargetPlatform|.
6868
TargetPlatform target_platform_ = TargetPlatform::kUnknown;
6969
// Use |PlatformsToCompile|.
70-
std::vector<TargetPlatform> runtime_stages_ = {};
70+
std::vector<TargetPlatform> runtime_stages_;
7171
};
7272

7373
} // namespace compiler

impeller/compiler/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <codecvt>
99
#include <locale>
1010
#include <map>
11+
#include <optional>
1112
#include <string>
1213

1314
#include "flutter/fml/macros.h"

0 commit comments

Comments
 (0)