mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Catch divide-by-zero errors early in license tool (flutter/engine#4382)
If Progress is instantiated with a max of 0, throw immediately to avoid a divide-by-zero later in toString(). This typically happens if the tool recurses over an empty top-level component, which can happen when a component is moved around in the repo and the developer hasn't cleaned up old empty directories from their git client.
This commit is contained in:
parent
2aad4c763e
commit
348fff3dd4
@ -2313,7 +2313,13 @@ class RepositoryRoot extends RepositoryDirectory {
|
||||
|
||||
|
||||
class Progress {
|
||||
Progress(this.max);
|
||||
Progress(this.max) {
|
||||
// This may happen when a git client contains left-over empty component
|
||||
// directories after DEPS file changes.
|
||||
if (max <= 0)
|
||||
throw new ArgumentError('Progress.max must be > 0 but was: $max');
|
||||
}
|
||||
|
||||
final int max;
|
||||
int get withLicense => _withLicense;
|
||||
int _withLicense = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user