parse-community / Parse-SDK-Android

The Android SDK for Parse Platform
https://parseplatform.org/
Other
1.88k stars 735 forks source link

Adding key verification to the getDouble method #1077

Closed jlucas577 closed 3 years ago

jlucas577 commented 3 years ago

Hey guys! I don't know if this is the correct way to suggest a change .. but I had a problem recently deciding to make a contribution ..

When trying to give a getDouble in a parse field that could return me undefined, it ended up generating an error in the application, but specifically "Method threw 'java.lang.IllegalStateException' exception." with the following message "ParseObject has no data for 'totalCredits'. Call fetchIfNeeded () to get the data.".

So I am uploading the correction I needed to make in my code.

Function in my local code that was causing problems:

var input: Double
         get () = getDouble ("input")
         set (value) = putOrIgnore ("input", value)

Function in my local code after corrected:

var input: Double
         get () = if (has ("input")) getDouble ("input") else 0.0
         set (value) = putOrIgnore ("input", value)

So I decided to add the has function directly in Parse's getDouble method.

Jawnnypoo commented 3 years ago

Hey, thanks for doing this, but this would be a client breaking change for clients that don't know about this change or are expecting errors to be thrown otherwise. It makes sense to do this on your app side, and your solution is good, just not something we can add to the SDK at this time.