[flutter_tools] Fix crash on null Android apiVersion (#50029)
This commit is contained in:
@@ -1040,7 +1040,11 @@ class _AdbLogReader extends DeviceLogReader {
|
||||
];
|
||||
// logcat -T is not supported on Android releases before Lollipop.
|
||||
const int kLollipopVersionCode = 21;
|
||||
final int apiVersion = int.tryParse(await device._apiVersion);
|
||||
final int apiVersion = (String v) {
|
||||
// If the API version string isn't found, conservatively assume that the
|
||||
// version is less recent than the one we're looking for.
|
||||
return v == null ? kLollipopVersionCode - 1 : int.tryParse(v);
|
||||
}(await device._apiVersion);
|
||||
if (apiVersion != null && apiVersion >= kLollipopVersionCode) {
|
||||
args.addAll(<String>[
|
||||
'-T',
|
||||
|
||||
Reference in New Issue
Block a user