Open jMarcS opened 7 years ago
Forum user Sprougnaf discovered a crash when a program using PROGRAM.INFO
is launched from ShortcutLauncher. See http://rfobasic.freeforums.org/program-info-t4972.html
Is this the same bug?
Released in Version 01.91, 2017/03/14. Leaving the issue open until mougino's question is resolved.
This is a spin-off of Issue #217, where
Basic.getRelativePath(String, String)
was added to support the newProgram.Info
command.Editor.onResume()
can callgetRelativePath()
with two identical paths. It happens, for example, if you are in the BASIC! Editor and you rotate the phone: after normalizing, both target and base paths are (on my Android 5.1 Moto G) "/storage/emulated/0/rfo-basic/source". The logic that constructs the common path adds "/" to every segment, so the result is "/storage/emulated/0/rfo-basic/source/". This is one character longer than the normalized target and base, so on this lineBASIC! crashes with an
IndexOutOBoundsException
.When the paths are the same, the
substring()
result is empty. That means I can hack a fix by adding a length condition:I can't do more now, gotta get v01.91 onto Google Play. But some day we ought to revisit this code.