hold17 / cphindustries

App for CPH Industries to manage weapons made for movies.
MIT License
0 stars 1 forks source link

Deleting weapons causes crash #107

Closed algorythm closed 6 years ago

algorythm commented 6 years ago

Description

Deleting a weapon and then going back to the view fragment causes the app to crash.

Steps to Reproduce

  1. Go to a scene
  2. Go to a shoot
  3. Click the lock button
  4. Delete a weapon by swiping
  5. Click the lock button again to return to the view fragment

Expected behavior: Display a list of weapons without the one you just deleted

Actual behaviour: Crash

Reproduces how often: 100%

Versions

Additional Information

To make this error occur, make sure to have at least:*

algorythm commented 6 years ago

Easy fix: the wrong id were passed into the method to delete a ShootWeapon. The ShootWeaponId were given rather than the WeaponId. Makes sense that it crashes.

It crashes because the weapon gets deleted, however there are still a relation between the Shoot and the Weapon. Since the Weapon doesn't exist (its id is no more), a null object is returned when asking for all Weapons to that specific Shoot which results in a NullPointerException.