mbbsemu / MBBSEmu

The MajorBBS Emulation Project is an Open Source, Cross-Platform emulator for easily running The MajorBBS & Worldgroup Modules
https://www.mbbsemu.com
MIT License
134 stars 13 forks source link

[WCCMUD] Major Mud - Crashes if you hit enter on a blank stat value #242

Closed tuday2 closed 4 years ago

tuday2 commented 4 years ago

Module Information

Describe the bug Crashes if you hit enter on a blank stat value

To Reproduce Steps to reproduce the behavior:

  1. Enter MajorMud module
  2. Enter character creation
  3. Blank out stat and hit enter
  4. See Error

Expected behavior FSD gives error on blank stat and you can correct

Screenshots

Unhandled exception. System.FormatException: Input string was not in a correct format.
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
   at System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)
   at System.Int32.Parse(String s)
   at MBBSEmu.HostProcess.HostRoutines.FsdRoutines.ValidateField(SessionBase session, FsdStatus fsdStatus)
   at MBBSEmu.HostProcess.HostRoutines.FsdRoutines.InFullScreenDisplay(SessionBase session)
   at MBBSEmu.HostProcess.HostRoutines.FsdRoutines.ProcessSessionState(SessionBase session, Dictionary`2 modules)
   at MBBSEmu.HostProcess.MbbsHost.WorkerThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ThreadHelper.ThreadStart()

FSDissue2

Software Information:

enusbaum commented 4 years ago

Issue was caused by the switch in FsdRoutes.cs which evaluates an int.Parse() to determine if the value you entered in the MajorMUD character screen is above or below a given value. I added a case prior to those evaluations which checks for a int.TryParse() failure and displays an appropriate message.

image

PR Pending