Universal-Debloater-Alliance / universal-android-debloater-next-generation

Cross-platform GUI written in Rust using ADB to debloat non-rooted Android devices. Improve your privacy, the security and battery life of your device.
GNU General Public License v3.0
2.57k stars 88 forks source link

bug(settings): Panic if searching for devices #532

Closed Rudxain closed 4 months ago

Rudxain commented 4 months ago

Describe the bug

  1. adb not needed. In fact, it's easier to repro if it isn't available
  2. Open UAD
  3. Click the cog icon (settings) before a device is connected
  4. Crash happens

Expected behavior

Same as when UAD gives up on trying to find a device, which makes a non-existent "user 0" available, preventing the crash

You have a solution?

2 alts:

Provide logs

thread 'main' panicked at src/gui/views/settings.rs:481:41: called Option::unwrap() on a None value

Acknowledgements

Rudxain commented 4 months ago

I stumbled upon this when trying to debug #531, but it also happens on upstream.

It's annoying to have to connect a device just to debug faster. Maybe there should be a button or CLI flag to stop UAD from searching devices?

Rudxain commented 4 months ago

I've found the source of the regression: https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation/pull/527/files#diff-ab8fdd0e30bade065fcdbadef147f14626783f8c82de0924f9312b80644edd36R481

It seems it'll be hard to avoid the "Hacky" solution I mentioned, unless all of the data dependencies can be moved to the conditional branch that actually needs them (I'm afraid there are useful side-effects that will be deferred). I'll give it a try...

Rudxain commented 4 months ago

I've found another bug while comparing behaviors between:

AnonymousWP commented 4 months ago

Good work on researching this!

It's annoying to have to connect a device just to debug faster. Maybe there should be a button or CLI flag to stop UAD from searching devices?

Agreed.

Rudxain commented 4 months ago

Good work on researching this!

Thanks!

Agreed.

I'll create an issue for that