Skip to content

Commit c343d96

Browse files
fix integer parse
1 parent 556014b commit c343d96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/francescodisalesdev/gitcli/service/GitService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ public int getPages(String param) throws IOException
7373
String URL = "https://github.com/search?q="+param;
7474
Document document = Jsoup.connect(URL).get();
7575
Elements elementsLinks = document.select("em");
76+
String pages = elementsLinks.attr("data-total-pages").toString();
7677

77-
int pagesValue = Integer.parseInt(elementsLinks.attr("data-total-pages").toString());
78+
if(pages.isEmpty())
79+
return 0;
80+
81+
int pagesValue = Integer.parseInt(pages);
7882
return pagesValue;
7983

8084
}

0 commit comments

Comments
 (0)