Not sure whether "\n" is included as part of the returned read string. I thougt you could test on
if [ $var1 -eq "\n" ]
if [ $var1 -eq "" ]
One of the two will work, and echoing any read in variable in Bash is a must during development anyway.
It might be obvious, but run your program with
You'll see what is going on.