Skip to content

fix sanitizeStringForAlphaCompare crashes on empty string

Mc LP requested to merge McLP/vlc-android:master into master

I added a check for empty strings in sanitizeStringForAlphaCompare, in which case it will just return the string itself.

Motivation and Context

My VLC on Android sometimes crashes due to a bad samba share in my network, that ultimately leads to a NoSuchElementException in sanitizeStringForAlphaCompare, probably due to being called on an empty string when discovering the share. This is my attempt at fixing this crash.

How Has This Been Tested?

Since I have no control over the share in question, I can't really test if this is the only place where it breaks. It does still compile and run on my phone tough, so it should be fine.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which cleans up / improves existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the CONTRIBUTING section of the README document.

Resolves

I did not create a separate issue since this seems to me like a very small fix, that would not need discussion (but I do appreciate any feedback, since this is my first contribution here).

Merge request reports