Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github.jorgecastillo.svg.SvgPathParser.ParsePath() #22

Open
reema07 opened this issue May 28, 2018 · 15 comments
Open

github.jorgecastillo.svg.SvgPathParser.ParsePath() #22

reema07 opened this issue May 28, 2018 · 15 comments

Comments

@reema07
Copy link

reema07 commented May 28, 2018

I am new in Android Studio Development

could you please guide me how to resolve this error to find the null point of string path error in SvgPathParser class parsePath() function pathstring not found.

@aligkts
Copy link

aligkts commented Feb 26, 2019

I have same issues.I could not solve it.

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

Can you2 paste some code producing this or what did you follow when this appeared?

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

(I am not on computer but lets get more info).

Can you print/share the value of you path (SvgPath.Bag.path)? It seems like that is NULL...

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

(your replies are a bit messed since you reply on mails)

Ok, so since public FillableLoaderBuilder svgPath(String svgPath) takes String and you feed it with val we can start with that alignment. Here I assume that path contains something like string with "\n" for end of line characters, some string numbers with dots and stuff (so not OS path)...

@aligkts
Copy link

aligkts commented Feb 26, 2019

Yes my path contains "\n" and "+".What do you think?

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

Did you try to change the path variable from val to String? It seems like the length is somehow null and that hits the null pointer exception.

@aligkts
Copy link

aligkts commented Feb 26, 2019

It is already 'val path: String?' when I change it to 'path: String?',this does not refers path 'val path= SvgPath.Bag.path'

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

I would indeed change val path= SvgPath.Bag.path to String path= SvgPath.Bag.path to make it more explicit. You confirmed with debugger that path then contains a proper string which is passed to svgPath()? Just go step by step with break points if logcat print messages are not revealing enough.

@aligkts
Copy link

aligkts commented Feb 26, 2019

In Kotlin language, val path= SvgPath.Bag.path refers to Java's String path= SvgPath.Bag.path

@aligkts
Copy link

aligkts commented Feb 26, 2019

Path does not comes null I checked that but I have no idea about what is the problem :(

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

Kotlin... huh I am indeed rusty. Can you again paste the LogCat error and a nicely formatted example? I was on Java, but this might be issue with Kotlin calling Java?

@aligkts
Copy link

aligkts commented Feb 26, 2019

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at com.github.jorgecastillo.svg.SvgPathParser.parsePath(SvgPathParser.java:52) at com.github.jorgecastillo.FillableLoader.buildPathData(FillableLoader.java:374) at com.github.jorgecastillo.FillableLoader.onSizeChanged(FillableLoader.java:224)

this is LogCat error

@Letme
Copy link
Contributor

Letme commented Feb 26, 2019

So the error reads exactly what I said, but what you pasted before was .build() method - so I assume logcat marks that line as failure in your application? You will have to give a lot more information if you want me to help you debug this, because now I can only guess.

@Letme
Copy link
Contributor

Letme commented Feb 27, 2019

OK few ideas (remember don't know Kotlin syntax or background so might be totally off):

  • I assume you confirmed without this lines the fragment loads (put a textview in to start with), because I remember you have to inflate fragments and stuff like that
  • Maybe a simple var string instead of enum class would do the trick (although I read over Kotlin help on enum class and it should return String like you say it does)
  • For future you are missing fillableLoader.setOnStateChangeListener(this); later on, because I see your error originates from: com.github.jorgecastillo.FillableLoader.onSizeChanged(FillableLoader.java:224), which might also be something coming from onStateChange trigger in second loop (error is kinda short and does not map to your code so I am guessing again).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants