DogOSdev / DogOS

A Operating System made with Cosmos and in C#. 🐕
https://DogOSdev.github.io/
BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

[BUG] Executing a command throws a exception and crashes the OS. #6

Closed TaromaruYuki closed 2 years ago

TaromaruYuki commented 2 years ago

Executing a command in the shell without any arguments throws a NotImplemented exception.

vmware_tNMeKVMfX8

The error doesn't really make sense, since I'm not converting any Enum to a string.

Why would it be throwing this, and why when there is no params?

TaromaruYuki commented 2 years ago

It's not only that command, it's also in the SHA256 command. Why???

TaromaruYuki commented 2 years ago

Finding help in the CosmosOS Discord led someone to the ExecuteCommand function. So it's something in there.

Possibly in the ParseInput method as well, since that is the only place ToString is called.

TaromaruYuki commented 2 years ago

It has to be in the ParseInput method.

Explained by someone in the Discord server:

well it is looking for an argument which in this case is not present so your function crashes since it is looking for an argument, what you could do is where you split the string you check if the argument is not null or empty , if so then execute a command , otherwise print a message or do something else

Which would make sense why it would be converting something to a string.

TaromaruYuki commented 2 years ago

Found the problem, parsing the input is fine. But checking if the help flag is set? Nope. Currently, a simple if (args[0] == "-h" || args[0] == "--help") is set, but in this situation, args[0] is empty / null.

A simple if statement should solve the problem.

TaromaruYuki commented 2 years ago

Fixed.