Skip to content
This repository was archived by the owner on Jan 3, 2019. It is now read-only.

Commit d11074a

Browse files
authored
Merge pull request #28 from Connexions/book-url-fix
Fixed user reported null pointer
2 parents a73a599 + 3438832 commit d11074a

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "org.cnx.android"
1111
minSdkVersion 19
1212
targetSdkVersion 25
13-
versionCode 39
14-
versionName "6.4"
13+
versionCode 40
14+
versionName "6.5"
1515
}
1616
dependencies{
1717
compile 'com.android.support:appcompat-v7:25.3.1'

app/src/main/java/org/cnx/android/handlers/MenuHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public boolean handleContextMenu(int item, Context context, Content currentConte
6363
//Log.d("MenuHandler","title - " + currentContent.getTitle()) ;
6464
cv.put(Favs.TITLE, currentContent.getTitle());
6565
//Log.d("MnHndlr.handleCont...()","URL: " + currentContent.getUrl().toString());
66-
String url = currentContent.getUrl().toString();
67-
if(isSearch(url, context))
66+
String url = currentContent.getUrl();
67+
if(url == null || url.equals("") || isSearch(url, context))
6868
{
6969
return false;
7070
}

app/src/main/java/org/cnx/android/logic/WebviewLogic.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public class WebviewLogic
1818
{
1919
public String getBookURL(String url)
2020
{
21+
if(url == null)
22+
{
23+
return "";
24+
}
2125
int cIndex = url.lastIndexOf(":");
2226
if(cIndex > 5)
2327
{
@@ -87,8 +91,9 @@ public String getBookTitle(String title)
8791
public void setContentURLs(String currentURL, Content content)
8892
{
8993
content.setUrl(currentURL);
90-
WebviewLogic wl = new WebviewLogic();
91-
String bookURL = wl.getBookURL(currentURL);
94+
//WebviewLogic wl = new WebviewLogic();
95+
//String bookURL = wl.getBookURL(currentURL);
96+
String bookURL = getBookURL(currentURL);
9297
content.setBookUrl(bookURL);
9398
}
9499
}

0 commit comments

Comments
 (0)