epam / epam/Indigo

After clicking the 'Save as...' button, an error message appears: (array: invalid index -2 (size=0))

Open
#1,318 0 comments 0 reactions 1 assignee Claimed by @even1024 View on GitHub
Dominant language
C++
Stars
406
Forks
134
Avg merge
2d 11h
Merged PRs (30d)
24

Description

**Steps to Reproduce**
1. Open file [Multi.zip](https://github.com/epam/Indigo/files/12866727/Multi.zip)
2. Press 'Save as...' button

**Actual behavior**
After clicking the 'Save as...' button, an error message appears: (array: invalid index -2 (size=0))

**Expected behavior**
File is saved without any errors.

**Screenshots**

![2023-10-11_11h19_55](https://github.com/epam/Indigo/assets/62464241/7caaeb9a-306f-4a3c-b86e-7e27c48e0669)

Payload:
```
{
"struct": "{\n \"root\": {\n \"nodes\": [\n {\n \"$ref\": \"mol0\"\n },\n {\n \"$ref\": \"mol1\"\n },\n {\n \"type\": \"arrow\",\n \"data\": {\n \"mode\": \"open-angle\",\n \"pos\": [\n {\n \"x\": 12.204558219194714,\n \"y\": -7.925000000000001,\n \"z\": 0\n },\n {\n \"x\": 13.545441780805286,\n \"y\": -7.925000000000001,\n \"z\": 0\n }\n ]\n }\n }\n ]\n },\n \"mol0\": {\n \"type\": \"molecule\",\n \"atoms\": [\n {\n \"label\": \"C\",\n \"location\": [\n 4.066853757214407,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 4.9328759506707955,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 5.798898144127184,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 6.664919760835646,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 7.530942531039962,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 8.396964147748424,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 9.262985764456886,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 10.1290085346612,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 10.99503015136966,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 7.530942531039962,\n -8.674967822164326,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 6.664919760835646,\n -8.174948709450604,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 6.664919760835646,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 5.798898144127184,\n -6.675013065121953,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 5.798898144127184,\n -5.674975416442434,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 4.9328759506707955,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 4.9328759506707955,\n -8.174948709450604,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 4.066853757214407,\n -6.675013065121953,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 3.200831563758019,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 2.334809370301631,\n -6.675013065121953,\n 0\n ]\n }\n ],\n \"bonds\": [\n {\n \"type\": 1,\n \"atoms\": [\n 0,\n 1\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 2,\n 3\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 3,\n 4\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 4,\n 5\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 5,\n 6\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 6,\n 7\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 7,\n 8\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 4,\n 9\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 9,\n 10\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 10,\n 11\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 11,\n 12\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 12,\n 13\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 12,\n 14\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 14,\n 15\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 14,\n 16\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 16,\n 17\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 17,\n 18\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 2,\n 1\n ]\n }\n ],\n \"sgroups\": [\n {\n \"type\": \"SRU\",\n \"atoms\": [\n 4,\n 10,\n 9,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18\n ],\n \"subscript\": \"n\",\n \"connectivity\": \"HT\"\n },\n {\n \"type\": \"MUL\",\n \"atoms\": [\n 3,\n 2,\n 4,\n 5,\n 6,\n 10,\n 9,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18\n ],\n \"mul\": 3\n },\n {\n \"type\": \"SRU\",\n \"atoms\": [\n 14,\n 12,\n 13,\n 15,\n 16\n ],\n \"subscript\": \"n\",\n \"connectivity\": \"HT\"\n }\n ]\n },\n \"mol1\": {\n \"type\": \"molecule\",\n \"atoms\": [\n {\n \"label\": \"C\",\n \"location\": [\n 16.487014235543114,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 17.35303469875572,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 18.21905862245589,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 19.085080239164355,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 19.95110185587282,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 20.81712347258128,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 21.68314739628145,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 22.549169012989907,\n -10.175024583557567,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 23.415190629698373,\n -9.675006047591774,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 19.95110185587282,\n -8.674967822164326,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 19.085080239164355,\n -8.174948709450604,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 19.085080239164355,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 18.21905862245589,\n -6.675013065121953,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 18.21905862245589,\n -5.674975416442434,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 17.35303469875572,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 17.35303469875572,\n -8.174948709450604,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 16.487014235543114,\n -6.675013065121953,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 15.620991465338799,\n -7.175032177835677,\n 0\n ]\n },\n {\n \"label\": \"C\",\n \"location\": [\n 14.75496984863034,\n -6.675013065121953,\n 0\n ]\n }\n ],\n \"bonds\": [\n {\n \"type\": 1,\n \"atoms\": [\n 6,\n 7\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 0,\n 1\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 2,\n 1\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 2,\n 3\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 3,\n 4\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 4,\n 5\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 5,\n 6\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 7,\n 8\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 4,\n 9\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 9,\n 10\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 10,\n 11\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 11,\n 12\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 12,\n 13\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 12,\n 14\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 14,\n 15\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 14,\n 16\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 16,\n 17\n ]\n },\n {\n \"type\": 1,\n \"atoms\": [\n 17,\n 18\n ]\n }\n ],\n \"sgroups\": [\n {\n \"type\": \"SRU\",\n \"atoms\": [\n 16,\n 12,\n 14,\n 15,\n 13\n ],\n \"subscript\": \"n\",\n \"connectivity\": \"HT\"\n },\n {\n \"type\": \"MUL\",\n \"atoms\": [\n 6,\n 2,\n 5,\n 4,\n 3,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18\n ],\n \"mul\": 3\n },\n {\n \"type\": \"SRU\",\n \"atoms\": [\n 4,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18\n ],\n \"subscript\": \"n\",\n \"connectivity\": \"HT\"\n },\n {\n \"type\": \"DAT\",\n \"atoms\": [\n 13\n ],\n \"fieldName\": \"\",\n \"fieldData\": \"Cl-Br\"\n },\n {\n \"type\": \"GEN\",\n \"atoms\": [\n 2,\n 1,\n 3,\n 4,\n 5,\n 6,\n 7,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18\n ]\n },\n {\n \"type\": \"DAT\",\n \"atoms\": [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7\n ],\n \"fieldName\": \"\",\n \"fieldData\": \"C\",\n \"bonds\": [\n 0,\n 2,\n 3,\n 4,\n 5,\n 6\n ]\n }\n ]\n }\n}",
"output_format": "chemical/x-mdl-rxnfile",
"options": {
"smart-layout": true,
"ignore-stereochemistry-errors": true,
"mass-skip-error-on-pseudoatoms": false,
"gross-formula-add-rsites": true,
"aromatize-skip-superatoms": true,
"dearomatize-on-load": false,
"ignore-no-chiral-flag": false,
"gross-formula-add-isotopes": true
}
}
```
Responce:
```


The page is temporarily unavailable


/*<![CDATA[*/
body {
background-color: #fff;
color: #000;
font-size: 0.9em;
font-family: sans-serif,helvetica;
margin: 0;
padding: 0;
}
:link {
color: #c00;
}
:visited {
color: #c00;
}
a:hover {
color: #f50;
}
h1 {
text-align: center;
margin: 0;
padding: 0.6em 2em 0.4em;
background-color: #294172;
color: #fff;
font-weight: normal;
font-size: 1.75em;
border-bottom: 2px solid #000;
}
h1 strong {
font-weight: bold;
font-size: 1.5em;
}
h2 {
text-align: center;
background-color: #3C6EB4;
font-size: 1.1em;
font-weight: bold;
color: #fff;
margin: 0;
padding: 0.5em;
border-bottom: 2px solid #294172;
}
h3 {
text-align: center;
background-color: #ff0000;
padding: 0.5em;
color: #fff;
}
hr {
display: none;
}
.content {
padding: 1em 5em;
}
.alert {
border: 2px solid #000;
}

img {
border: 2px solid #fff;
padding: 2px;
margin: 2px;
}
a:hover img {
border: 2px solid #294172;
}
.logos {
margin: 1em;
text-align: center;
}
/*]]>*/


nginx error!

The page you are looking for is temporarily unavailable. Please try again later.


Website Administrator



Something has triggered an error on your
website. This is the default error page for
nginx that is distributed with
Amazon Linux 2. It is located
/usr/share/nginx/html/50x.html

You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.



[ Powered by nginx ]

[ Powered by Amazon Linux 2 ]



```
**Desktop (please complete the following information):**
- OS: Windows 10
- Browser Chrome
- Version 112.0.5615.138 (Official Build) (64-bit)

**Indigor version**
[Version 1.14.0-rc.6](https://lifescience.opensource.epam.com/ketcher/index.html)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.