NMitchell24 / CraftingCalculator

Simple Crafting Calculator for Survival Crafting Games
GNU General Public License v2.0
3 stars 1 forks source link

NullReferenceException when deleting recipe that is referenced by another recipe. #22

Closed NMitchell24 closed 3 years ago

NMitchell24 commented 3 years ago

Describe the bug Null Reference Exception when deleting a Recipe that is referenced by another Recipe. Appears that the RecipeQuantityData is not properly getting deleted. The NullReferenceException occurs on reload of the screen because the ChildRecipe on the RecipeQuantityData is null. This RecipeQuantityData should have been completely deleted.

To Reproduce

  1. Steps to reproduce the behavior:
  2. File > Open Recipe Configuration
  3. Add new Ingredient. Name= 123, Desc = 123
  4. save
  5. Select Recipe Filter Data Type
  6. Add new Filter Name= 123, desc=123
  7. save
  8. Select Recipe Data Type
  9. Add new Recipe, name=123, recipe filter = 123, recipe description = 123
  10. Select Recipe Component Type Recipe
  11. Then Select recipe component type Ingredient
  12. Ingredient Value = 123
  13. Quantity = 10
  14. Add.
  15. Save.
  16. Click Add at top of screen
  17. Recipe Name = 1234
  18. Recipe Filter = 123
  19. Recipe Description = 1234
  20. Recipe Components; Ingredient, 123, 10 Add
  21. Recipe Components; Recipe, 123, 10, add
  22. Save
  23. Select Data Type Ingredient
  24. Select 123 and delete
  25. Select Data Type Recipe Filter
  26. Select 123 and Delete
  27. Select Data Type Recipe
  28. Select 123 and Delete
  29. NullReferenceException occurs in RecipeService(94)

Expected behavior Deleting recipes that are referenced by other recipes should correctly clear the RecipeQuantityData from any other references and not leave orphaned records.

Affected Versions 2.0.0.0 (RecipeManager_1)

NMitchell24 commented 3 years ago

Resolved with Commit 4db3393