File tree 1 file changed +12
-9
lines changed
graphics-by-opengl-j2se/src/main/java/com/nucleus/renderer
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,22 @@ public static class Version {
27
27
public Version (String versionStr ) {
28
28
int offset = 0 ;
29
29
int whitespace = 0 ;
30
+ String result = null ;
30
31
while ((whitespace = versionStr .indexOf (" " , offset )) != -1 ) {
32
+ result = versionStr .substring (offset , whitespace );
33
+ if (result .contains ("." )) {
34
+ break ;
35
+ }
31
36
offset = whitespace + 1 ;
32
37
}
33
- versionStr = versionStr .substring (offset );
34
- int dotIndex = versionStr .indexOf ("." );
35
- if (dotIndex < 0 ) {
36
- // No dot
37
- major = Integer .parseInt (versionStr );
38
- minor = 0 ;
39
- } else {
40
- major = Integer .parseInt (versionStr .substring (0 , dotIndex ));
41
- minor = Integer .parseInt (versionStr .substring (dotIndex + 1 ));
38
+ if (whitespace == -1 ) {
39
+ result = versionStr .substring (offset );
42
40
}
41
+ int dotIndex = result .indexOf ("." );
42
+ major = Integer .parseInt (result .substring (0 , dotIndex ));
43
+ // Check for release number
44
+ StringTokenizer st = new StringTokenizer (result .substring (dotIndex + 1 ));
45
+ minor = Integer .parseInt (st .nextToken ());
43
46
}
44
47
}
45
48
You can’t perform that action at this time.
0 commit comments