I am trying to display Picklist values based on the picklist field selected on a VF page, I get Null pointer exception . Can someone please help.

enter image description here

enter image description here

  • please add the error line
    – d_k
    May 1, 2017 at 8:39
  • 2
    Generally speaking, including code as an image is not a great idea. If you happen to have a few long lines (easy to do once you have blocks nested several levels deep), the image will be resized. This usually leads to the text being so small that it can't be read without clicking a few times to view the full size image. It also prevents people from copy/pasting your code into the dev console to reproduce and verify the source of your issues. In the end, it's about making it as easy for people to help you as possible, and code screenshots don't make it easy to help.
    – Derek F
    May 1, 2017 at 13:49

1 Answer 1


This error is occurring because of your commented code:

pickListValues = new List<String>();

you are not instantiating the list and so the error occurs when you try to add an element to it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .