[Tex/LaTex] There is no line here to end \makelettertitle error in moderncv

errorsmoderncv

I am using moderncv templates, on cover letter page i wanted to edit the original code so that the Name/mobile/email appears on top right corner,
enter image description here
but the Build process return the error: There's no line here to end. \makelettertitle
Here is the location that error is happening, if i put any character in \recipient{}{} line such as \recipient{'}{} the error would be solved,but the character will be shown in the result,which i don't want it, i searched for similar cases but none of the solutions given helped, is there any solution for it if i don't want to use \recipient ? (I have tried removing it from the code but it didn't work) The code:

\documentclass{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\firstname{John} % Your first name
\familyname{Smith} % Your last name
\title{Curriculum Vitae}
\mobile{(+1) 123 456 7890}
\email{john.smith@gmail.com}
\begin{document}
\clearpage
\recipient{}{} % Letter recipient
\date{\today} % Letter date
\opening{Dear Sir, Madam,} % Opening greeting
\closing{Sincerely yours,} % Closing phrase
\enclosure[Attached]{curriculum vit\ae{}} % List of enclosed documents
\makelettertitle % Print letter title
I am an engineer

\makeletterclosing

\end{document}

and the content of class file is:

\newcommand{\recipient}[2]{\def\@recipientname{#1}\def\@recipientaddress{#2}}
\renewcommand*{\date}[1]{\def\@date{#1}}\date{\today}
\newcommand{\opening}[1]{\def\@opening{#1}}
\newcommand*{\closing}[1]{\def\@closing{#1}}
\newcommand*{\enclosure}[2][]{%
  % if an optional argument is provided, use it to redefine \enclname
  \ifthenelse{\equal{#1}{}}{}{\renewcommand*{\enclname}{#1}}%
  \def\@enclosure{#2}}

Best Answer

The class loads the auxiliary package moderncvheadi.sty, which has

  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress%
  \end{minipage}

and this means that if \@recipientname is empty, you get the usual error of a lone \\, that is There's no line to end.

Solution:

\recipient{\mbox{}}{}

which will make the line non empty, as far as \\ is concerned.