thebookisclosed / ViVe

C# library and console app for using new feature control APIs available in Windows 10 version 2004 and newer
GNU General Public License v3.0
4.97k stars 298 forks source link

Unhandled exception if feature ID not specified correctly #58

Closed riverar closed 2 years ago

riverar commented 2 years ago

Summary

When silly users, like me, specify feature IDs via /id 123456 instead of /id:123456 per the documentation, an unhandled exception occurs. (I only call this out because this also triggers my JIT debugger and interrupts my workflows.)

Version

ViVeTool v0.3.1

Steps to reproduce

  1. Issue command: vivetool /enable /id 123456
  2. Observe exception
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Albacore.ViVeTool.ArgumentBlock.Initialize(String[] args, ArgumentBlockFlags flags)
   at Albacore.ViVeTool.Program.ProcessArgs(String[] args)
   at Albacore.ViVeTool.Program.Main(String[] args)
riverar commented 2 years ago

Checking if value is null for various options in ArgumentBlock.cs and falling through if so seems to be the simplest fix here. Doing so will result in this output:

ViVeTool v0.3.1 - Windows feature configuration tool

Unrecognized parameter: /id

Unrecognized parameter: 123

No features were specified

If you're okay with that @thebookisclosed, I can submit a simple PR.

thebookisclosed commented 2 years ago

I'll take a look later this week, already have one more small change I want to push. No need for a PR.

thebookisclosed commented 2 years ago

Fixed in v0.3.2 (56e0bb4925e09bfc38fb8250d145eaca2b5313da)

riverar commented 2 years ago

Thanks @thebookisclosed!