Only set TARGET_PLATFORM version in lunch when explicitly requested

Setting TARGET_PLATFORM_VERSION to DEFAULT_PLATFORM_VERSION during
"lunch sailfish-userdebug" causes unnecessary pain when
DEFAULT_PLATFORM_VERSION becomes invalid after branching.  Only
set TARGET_PLATFORM_VERSION if it was explicitly requested with
lunch sailfish-userdebug-OPR1.

Test: build/make/tests/envsetup_tests.sh
Bug: 34972208
Bug: 37208937
Change-Id: I40ba4617e73803c5bec1a8d317382f70fb3ec3a2
diff --git a/envsetup.sh b/envsetup.sh
index 55f4983..b40c2a1 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -620,7 +620,11 @@
 
     export TARGET_PRODUCT=$(get_build_var TARGET_PRODUCT)
     export TARGET_BUILD_VARIANT=$(get_build_var TARGET_BUILD_VARIANT)
-    export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
+    if [ -n "$version" ]; then
+      export TARGET_PLATFORM_VERSION=$(get_build_var TARGET_PLATFORM_VERSION)
+    else
+      unset TARGET_PLATFORM_VERSION
+    fi
     export TARGET_BUILD_TYPE=release
 
     echo