Skip to content

Commit 92b74da

Browse files
Fix tns init command
When tns init command is called in empty directory, there's no project data and getting projectName from projectId is failing.
1 parent 489c1e2 commit 92b74da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/services/android-project-service.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ class AndroidProjectService extends projectServiceBaseLib.PlatformProjectService
151151
}
152152

153153
private getProjectNameFromId(): string {
154-
return this.$projectData.projectId.split(".")[2];
154+
let id: string;
155+
if(this.$projectData && this.$projectData.projectId) {
156+
id = this.$projectData.projectId.split(".")[2];
157+
}
158+
159+
return id;
155160
}
156161

157162
public afterCreateProject(projectRoot: string): IFuture<void> {

0 commit comments

Comments
 (0)