@@ -2545,7 +2545,10 @@ int32_t TWinSCPFileSystem::GetFilesEx(TObjectList * PanelItems, bool Move,
2545
2545
FFileList.reset (CreateFileList (PanelItems, osRemote));
2546
2546
try__finally
2547
2547
{
2548
- Result = GetFilesRemote (PanelItems, Move, DestPath, OpMode);
2548
+ if (FFileList->GetCount () > 0 )
2549
+ {
2550
+ Result = GetFilesRemote (PanelItems, Move, DestPath, OpMode);
2551
+ }
2549
2552
}
2550
2553
__finally
2551
2554
{
@@ -2559,8 +2562,12 @@ int32_t TWinSCPFileSystem::GetFilesEx(TObjectList * PanelItems, bool Move,
2559
2562
UnicodeString Prompt;
2560
2563
if (PanelItems->GetCount () == 1 )
2561
2564
{
2562
- Prompt = FORMAT (GetMsg (NB_EXPORT_SESSION_PROMPT),
2563
- PanelItems->GetAs <TFarPanelItem>(0 )->GetFileName ());
2565
+ auto FileName = PanelItems->GetAs <TFarPanelItem>(0 )->GetFileName ();
2566
+ if (FileName == PARENTDIRECTORY)
2567
+ {
2568
+ return Result;
2569
+ }
2570
+ Prompt = FORMAT (GetMsg (NB_EXPORT_SESSION_PROMPT), FileName);
2564
2571
}
2565
2572
else
2566
2573
{
@@ -2779,7 +2786,7 @@ int32_t TWinSCPFileSystem::UploadFiles(bool Move, OPERATION_MODES OpMode, bool E
2779
2786
2780
2787
int32_t TWinSCPFileSystem::PutFilesEx (TObjectList * PanelItems, bool Move, OPERATION_MODES OpMode)
2781
2788
{
2782
- int32_t Result;
2789
+ int32_t Result = - 1 ;
2783
2790
if (Connected ())
2784
2791
{
2785
2792
FFileList.reset (CreateFileList (PanelItems, osLocal));
@@ -2788,6 +2795,10 @@ int32_t TWinSCPFileSystem::PutFilesEx(TObjectList * PanelItems, bool Move, OPERA
2788
2795
FPanelItems = nullptr ;
2789
2796
FFileList.reset ();
2790
2797
};
2798
+ if (FFileList->GetCount () == 0 )
2799
+ {
2800
+ return Result;
2801
+ }
2791
2802
FPanelItems = PanelItems;
2792
2803
2793
2804
// if file is saved under different name, FAR tries to upload original file,
@@ -2828,21 +2839,18 @@ int32_t TWinSCPFileSystem::PutFilesEx(TObjectList * PanelItems, bool Move, OPERA
2828
2839
FTerminal->SetCurrentDirectory (CurrentDirectory);
2829
2840
}
2830
2841
}
2831
- else if (IsSessionList ())
2842
+ else if (IsSessionList () && PanelItems )
2832
2843
{
2833
- if (!ImportSessions (PanelItems, Move, OpMode))
2844
+ if (PanelItems->GetCount () == 1 &&
2845
+ PanelItems->GetAs <TFarPanelItem>(0 )->GetFileName () == PARENTDIRECTORY)
2834
2846
{
2835
- Result = - 1 ;
2847
+ return Result ;
2836
2848
}
2837
- else
2849
+ if ( ImportSessions (PanelItems, Move, OpMode))
2838
2850
{
2839
2851
Result = 1 ;
2840
2852
}
2841
2853
}
2842
- else
2843
- {
2844
- Result = -1 ;
2845
- }
2846
2854
return Result;
2847
2855
}
2848
2856
0 commit comments