File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
src/main/java/com/evacipated/cardcrawl/modthespire Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 11## Changelog ##
22#### dev ####
3+ * Fix silent crash in auto-updater if a mod's release has a bad version number
34
45#### v3.6.1 ####
56* Fix silent crash if a mod has a bad version number
Original file line number Diff line number Diff line change 22
33import com .google .gson .*;
44import com .vdurmont .semver4j .Semver ;
5+ import com .vdurmont .semver4j .SemverException ;
56
7+ import javax .swing .*;
68import java .io .FileNotFoundException ;
79import java .io .IOException ;
810import java .io .InputStream ;
@@ -57,7 +59,17 @@ protected void obtainLatestRelease() throws IOException
5759 @ Override
5860 public Semver getLatestReleaseVersion () throws IOException
5961 {
60- return ModInfo .safeVersion (getElementAsString ("tag_name" ));
62+ try {
63+ return ModInfo .safeVersion (getElementAsString ("tag_name" ));
64+ } catch (SemverException e ) {
65+ JOptionPane .showMessageDialog (null ,
66+ getElementAsString ("html_url" )
67+ + "\n release has a missing or bad version number: \" "
68+ + getElementAsString ("tag_name" )
69+ + "\" .\n Go yell at the author to fix it." ,
70+ "Warning" , JOptionPane .WARNING_MESSAGE );
71+ return null ;
72+ }
6173 }
6274
6375 @ Override
Original file line number Diff line number Diff line change @@ -98,7 +98,12 @@ public boolean isNewerVersionAvailable(Semver current) throws IOException
9898 if (latest == null ) {
9999 return false ;
100100 }
101- return getLatestReleaseVersion ().compareTo (current ) > 0 ;
101+ Semver latestVersion = getLatestReleaseVersion ();
102+ if (latestVersion != null ) {
103+ return latestVersion .compareTo (current ) > 0 ;
104+ } else {
105+ return false ;
106+ }
102107 }
103108
104109 public JsonElement getElement (String key ) throws IOException
You can’t perform that action at this time.
0 commit comments