| Summary: | Incorrect warning for "Inconsistent return types: 'null', 'String'" | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Steve Northover <steve_northover> |
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | curtis.windatt.public, Olivier_Thomann |
| Version: | 12.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I'll take it. I added that check. I was checking for "string" and not "String". In some cases, the toString() on the retrieved type from tern returns "string" and sometimes it returns "String". I'll check for both. Delivered. |
This code fragment causes: Inconsistent return types: 'null', 'String' var getProjectName = function(name2){ if(name2.indexOf(" | ") !== -1){ var s = name2.split(" | "); return s.length > 1 ?name2.split(" | ")[1].trim() : name2; } return name2; }; Is the message correct? If name2 is null, then the if-statement blows up before the return is hit.