Repository: stable-diffusion-webui
Issue: save button causes a soft crash in loopback and inpaint. (IndexError: tuple index out of range)
Labels: bug-report

**Describe the bug**
when you try to save any individual picture except the first picture (like the grid) in img2img loopback or inpaint you get "IndexError: tuple index out of range" error.

**To Reproduce**
Steps to reproduce the behavior:
1. Generate anything, then send one to img2img or inpaint.
2. Go to img2img tab and select loopback script or inpaint (if you sent the pic there)
3. Set batch count to something more than 1, then generate. 
4. Try saving any pic but the first one (that one will save) and you get the soft crash.

**Expected behavior**
save selected picture. 

**The error**
Inpaint
```
Error completing request
Arguments: ('{"prompt": "masterpiece, best quality, cat, bird", "all_prompts": ["masterpiece, best quality, cat, bird"], "negative_prompt": "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.", "seed": 3691611137, "all_seeds": [3691611137], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 28, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "925997e9", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": 0.75, "extra_generation_params": {"Denoising strength change factor": 1}, "index_of_first_image": 0, "infotexts": ["masterpiece, best quality, cat, bird\\nNegative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.\\nSteps: 28, Sampler: Euler a, CFG scale: 7, Seed: 3691611137, Size: 512x512, Model hash: 925997e9, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221016094712", "clip_skip": 2}', [{'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp39z6fcl7.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp39z6fcl7.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpyj48g8vs.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpyj48g8vs.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7s5t6w4t.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7s5t6w4t.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmprl9a67xu.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmprl9a67xu.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0e9e2hip.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0e9e2hip.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpzih2_v6v.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpzih2_v6v.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7xdpmn_6.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7xdpmn_6.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmppu_pto2c.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmppu_pto2c.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnk3thjrb.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnk3thjrb.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5y1p4lvt.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5y1p4lvt.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvlr52jka.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvlr52jka.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpqc81tzhr.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpqc81tzhr.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpfn38l962.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpfn38l962.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1e8lr5a1.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1e8lr5a1.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpibez9g47.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpibez9g47.png', 'is_file': True}], False, 9) {}
Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 212, in f
    res = list(func(*args, **kwargs))
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 162, in save_files
    fullfn, txt_fullfn = save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)
IndexError: list index out of range

Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
    output = await app.blocks.process_api(
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 742, in postprocess_data
    if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range
```

loopback
```
Error completing request
Arguments: ('{"prompt": "masterpiece, best quality, cat, bird", "all_prompts": ["masterpiece, best quality, cat, bird"], "negative_prompt": "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.", "seed": 3276342138, "all_seeds": [3276342138], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 28, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "925997e9", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": 0.75, "extra_generation_params": {"Denoising strength change factor": 1}, "index_of_first_image": 0, "infotexts": ["masterpiece, best quality, cat, bird\\nNegative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.\\nSteps: 28, Sampler: Euler a, CFG scale: 7, Seed: 3276342138, Size: 512x512, Model hash: 925997e9, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221016101133", "clip_skip": 2}', [{'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpicfugela.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpicfugela.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpan45tmxf.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpan45tmxf.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1ceirpzz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1ceirpzz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp8nteufod.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp8nteufod.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpg0inz435.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpg0inz435.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmptv8xoe2i.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmptv8xoe2i.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvno3w4xy.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvno3w4xy.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnuaj28pe.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnuaj28pe.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2mt9qwhn.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2mt9qwhn.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0x15q54k.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0x15q54k.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5xfleijz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5xfleijz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7pl4gtrq.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7pl4gtrq.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp9qvl_hvz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp9qvl_hvz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2nahlnzp.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2nahlnzp.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmphmzck4kg.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmphmzck4kg.png', 'is_file': True}], False, 8) {}
Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 212, in f
    res = list(func(*args, **kwargs))
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 162, in save_files
    fullfn, txt_fullfn = save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)
IndexError: list index out of range

Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
    output = await app.blocks.process_api(
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 742, in postprocess_data
    if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range
```

**Desktop (please complete the following information):**
 - OS: Windows 10
 - Browser Brave with ad blocking off for localhost
 - Commit revision c57919ea2a8e4a23a05d21f28928e08bbf34c59e