Skip to content

Commit 38181c9

Browse files
Fix parse date for empty language (#28)
* Fix issue. Address pr comments * Track issue in changelog Co-authored-by: Wojciech Kryg <[email protected]>
1 parent d254452 commit 38181c9

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
### Removed
3131
- No removed features!
3232
### Fixed
33-
- No fixed issues!
33+
- Fix parse date for empty language. _Thanks to [@wojciechkryg](https://github.com/wojciechkryg) and [@rafid059](https://github.com/rafid059) for the contribution!_
3434
### Security
3535
- No security issues fixed!
3636

src/main/kotlin/com/hyperdevs/poeditor/gradle/network/api/PoEditorApiModels.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ data class ResponseStatus(val status: String,
5050
data class ProjectLanguage(val name: String,
5151
val code: String,
5252
val percentage: Double,
53-
val updated: Date)
53+
val updated: Date?)

src/main/kotlin/com/hyperdevs/poeditor/gradle/utils/DateJsonAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ class DateJsonAdapter : JsonAdapter<Date>() {
3636

3737
@Synchronized
3838
@Throws(IOException::class)
39-
override fun fromJson(reader: JsonReader): Date {
39+
override fun fromJson(reader: JsonReader): Date? {
4040
val string = reader.nextString()
41+
if (string == null || string.isBlank()) return null
4142
return sdf.parse(string)
4243
}
4344

0 commit comments

Comments
 (0)