Repository: flutter
Issue: Flutter tool should throwToolExit() when HOME/USERPROFILE is expected to be defined but isn't.
Labels: c: crash,tool,t: flutter doctor,P2,team-tool,triaged-tool

For example the Android Studio validator is not robust against this situation:

## command
```
flutter doctor
```
## exception
```
ArgumentError: Invalid argument(s): join(null, "Applications"): part 0 was null, but part 1 was not.
```
```
#0      _validateArgList (package:path/src/context.dart:1087:5)
#1      Context.join (package:path/src/context.dart:231:5)
#2      AndroidStudio._allMacOS (package:flutter_tools/src/android/android_studio.dart:198:29)
#3      AndroidStudio.allInstalled (package:flutter_tools/src/android/android_studio.dart:170:26)
#4      AndroidStudioValidator.allValidators (package:flutter_tools/src/android/android_studio_validator.dart:20:55)
#5      _DefaultDoctorValidatorsProvider.validators (package:flutter_tools/src/doctor.dart:63:35)
#6      Doctor.validators (package:flutter_tools/src/doctor.dart:132:46)
#7      Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:139:39)
#8      Doctor.diagnose (package:flutter_tools/src/doctor.dart:211:41)
<asynchronous suspension>
#9      DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:59:39)
<asynchronous suspension>
#10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#11     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#12     _rootRunUnary (dart:async/zone.dart:1132:38)
#13     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#14     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#16     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#17     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#18     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#19     _rootRun (dart:async/zone.dart:1124:13)
#20     _CustomZone.run (dart:async/zone.dart:1021:19)
#21     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#25     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
```

## flutter doctor

```
encountered exception: Invalid argument(s): join(null, "Applications"): part 0 was null, but part 1 was not.

#0      _validateArgList (package:path/src/context.dart:1087:5)
#1      Context.join (package:path/src/context.dart:231:5)
#2      AndroidStudio._allMacOS (package:flutter_tools/src/android/android_studio.dart:198:29)
#3      AndroidStudio.allInstalled (package:flutter_tools/src/android/android_studio.dart:170:26)
#4      AndroidStudioValidator.allValidators (package:flutter_tools/src/android/android_studio_validator.dart:20:55)
#5      _DefaultDoctorValidatorsProvider.validators (package:flutter_tools/src/doctor.dart:63:35)
#6      Doctor.validators (package:flutter_tools/src/doctor.dart:132:46)
#7      Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:139:39)
#8      Doctor.diagnose (package:flutter_tools/src/doctor.dart:211:41)
<asynchronous suspension>
#9      _doctorText.<anonymous closure> (package:flutter_tools/runner.dart:202:26)
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:29)
<asynchronous suspension>
#11     _rootRun (dart:async/zone.dart:1124:13)
#12     _CustomZone.run (dart:async/zone.dart:1021:19)
#13     _runZoned (dart:async/zone.dart:1516:10)
#14     runZoned (dart:async/zone.dart:1463:12)
#15     AppContext.run (package:flutter_tools/src/base/context.dart:153:18)
<asynchronous suspension>
#16     _doctorText (package:flutter_tools/runner.dart:201:19)
<asynchronous suspension>
#17     _createLocalCrashReport (package:flutter_tools/runner.dart:179:32)
<asynchronous suspension>
#18     _handleToolError (package:flutter_tools/runner.dart:134:33)
<asynchronous suspension>
#19     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:68:22)
<asynchronous suspension>
#20     _rootRun (dart:async/zone.dart:1124:13)
#21     _CustomZone.run (dart:async/zone.dart:1021:19)
#22     _runZoned (dart:async/zone.dart:1516:10)
#23     runZoned (dart:async/zone.dart:1500:12)
#24     run.<anonymous closure> (package:flutter_tools/runner.dart:61:18)
<asynchronous suspension>
#25     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:29)
<asynchronous suspension>
#26     _rootRun (dart:async/zone.dart:1124:13)
#27     _CustomZone.run (dart:async/zone.dart:1021:19)
#28     _runZoned (dart:async/zone.dart:1516:10)
#29     runZoned (dart:async/zone.dart:1463:12)
#30     AppContext.run (package:flutter_tools/src/base/context.dart:153:18)
<asynchronous suspension>
#31     runInContext (package:flutter_tools/src/context_runner.dart:58:24)
<asynchronous suspension>
#32     run (package:flutter_tools/runner.dart:50:10)
#33     main (package:flutter_tools/executable.dart:65:9)
<asynchronous suspension>
#34     main (file:///Users/ktoley/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#35     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#36     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
```