> > auto lst = context.getResults.initAccounts(1);
fixed my issue, thanks. On Sunday, November 4, 2018 at 9:52:31 PM UTC+3:30, Kenton Varda wrote: > > This line: > > auto lst = capnp::List< capnp::Text>::Builder(); > > is basically constructing `lst` to be a null pointer. So when you try to > set a value through it, you get an exception (or a segfault). > > Try this: > > auto lst = context.getResults.initAccounts(1); > lst.set(0, "reza"); > > (The 1 is the size of the list.) > > On Sun, Nov 4, 2018 at 10:09 AM <[email protected] <javascript:>> wrote: > >> Hi, I'm looking for a way to initialize a List<Text> as result of >> interface method. here is my interface design: >> >> interface AccountManager { >> echo @0 (title: Text) -> (result: Text); >> list @1 () -> (accounts : List(Text)); >> # get @1 (title: Text) -> (account: Account); >> } >> >> >> also I use following code for my server implementation: >> >> ::kj::Promise<void> list(ListContext context) override { >> >> auto lst = capnp::List< capnp::Text>::Builder(); >> lst.set(0, "reza"); >> context.getResults().setAccounts(lst); >> >> return kj::READY_NOW; >> } >> >> >> but I receive exception about list size in client. could anyone please >> help me about this error? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Cap'n Proto" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> Visit this group at https://groups.google.com/group/capnproto. >> > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
