Skip to content

Commit eab01cb

Browse files
committed
963: Bug during composer json generation
1 parent 9306cd5 commit eab01cb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/com/magento/idea/magento2plugin/actions/generation/generator/ModuleComposerJsonGenerator.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,15 @@ private Pair<String, String> getDependencyData(
184184
composerJsonFile.getText()
185185
);
186186
final JSONObject jsonObject = (JSONObject) obj;
187-
final String versionJsonElement = jsonObject.get("version").toString();
187+
final String versionJsonElement = jsonObject.get("version") != null
188+
? jsonObject.get("version").toString() : "*";
188189
final String nameJsonElement = jsonObject.get("name").toString();
189190

190-
if (versionJsonElement != null) {
191-
version = versionJsonElement;
192-
final int minorVersionSeparator = version.lastIndexOf('.');
193-
version = new StringBuilder(version)
194-
.replace(minorVersionSeparator + 1, version.length(),"*")
195-
.toString();
196-
}
191+
version = versionJsonElement;
192+
final int minorVersionSeparator = version.lastIndexOf('.');
193+
version = new StringBuilder(version)
194+
.replace(minorVersionSeparator + 1, version.length(),"*")
195+
.toString();
197196

198197
if (nameJsonElement != null) {
199198
moduleName = nameJsonElement;

0 commit comments

Comments
 (0)