Add check for urls without an extension

Eg: Instead of a url like .../Main_Page.html, just .../Main_Page
This commit is contained in:
Aditya-Sood 2019-08-14 19:40:51 +05:30
parent 0701c1aa7b
commit 1076a15097

View File

@ -202,10 +202,10 @@ public class AddNoteDialog extends DialogFragment
int rightmostDot = path.lastIndexOf('.'); int rightmostDot = path.lastIndexOf('.');
if (rightmostSlash > -1 && rightmostDot > -1) { if (rightmostSlash > -1 && rightmostDot > -1) {
return (path.substring(rightmostSlash + 1, rightmostDot)); return path.substring(rightmostSlash + 1, (rightmostDot > rightmostSlash) ? rightmostDot : path.length());
} }
return ""; // If couldn't find the dot and/or slash return ""; // If couldn't find a dot and/or slash in the url
} }
// Override onBackPressed() to respond to user pressing 'Back' button on navigation bar // Override onBackPressed() to respond to user pressing 'Back' button on navigation bar