Citing an article inside the caption in LaTeX

I have finally found the solution for the issue I had while I was preparing my report and I want to share it with you. I had an issue with citing an article inside the caption and LaTeX compiler (TeXstudio® which I am using) was failing. It was returning back with the error below:

Paragraph ended before \Hy@tempa was complete.

So after some search I found the solution which was using \protect before the \cite{} command e.g. \protect\cite{} .

For more information on how does \protect works, there is an interesting discussion here you can take advantage of it.